Skip to content

u/Rizbe

In this archive from Jun 2015 to May 2017

2
posts
63
comments
0
media
103
score

Better yet, let's say I want to deploy Grafana and use InfluxDB as my backend, how do I do this with docker?

    docker run  -p 8083:8083 -p 8086:8086 -d -v $PWD/influxdb:/var/lib/influxdb influxdb
    docker run -d -p 3000:3000 grafana/grafana

So what does the command above actually do? First one, it's deploying Influxdb on port 8083 and 8086 and using persistent volume to mount a directory on on your local system called influxdb to inside the container /var/lib/influxdb. This means that when you update your container, all your data is there and just remount that directory and everything works as expected. Want to make a change to the config, go to $PWD/influxdb and make changes in there and it will reflect in your container.

Second commands is running Grafana on port 3000

Let's say we want to have multiple Influxdb on the same system, how do we deploy another one?

docker run  -p 8084:8083 -p 8087:8086 -d -v $PWD/influxdb2:/var/lib/influxdb influxdb

Now I am running a second instance that is isolated and you can have as many of the same service running without an issue.

Want to deploy your very own minecraft server with one command? I wrote a docker container and pushed it to docker hub and you can run it by doing:

docker run -d -p 25565:25565 -v /opt/tekkit:/opt/tekkit --name mc rizbe/tekkit-legend

So how do you build your own docker container? Below is the dockerfile used to build the docker container above:

# This Dockerfile is used to build an image containing Minecraft Tekkit
FROM ubuntu:trusty
MAINTAINER Rizbe


# Make sure the package repository is up to date.
RUN apt update
RUN apt -y upgrade

#Install Java
RUN apt install openjdk-7-jre-headless unzip wget  -y

# Add user minecraft
RUN adduser --quiet minecraft
RUN mkdir /opt/tekkit
RUN chown -R minecraft /opt/tekkit


#Download Tekkit Legends
RUN wget -O /tmp/tekkit.zip http://servers.technicpack.net/Technic/servers/tekkit-legends/Tekkit_Legends_Server_v1.1.1.zip
RUN unzip /tmp/tekkit.zip -d /opt/tekkit
RUN chmod +x /opt/tekkit/start.sh
RUN chown -R minecraft /opt/tekkit

VOLUME ["/opt/tekkit"]
EXPOSE 25565

WORKDIR /opt/tekkit
USER minecraft
ENTRYPOINT ["/bin/sh","/opt/tekkit/start.sh"]

Let's say minecraft says we don't work with Java anymore, go into the docker file, just replace openjdk-7 with 8, build, test, push to repo, redploy and use the same volume you used and now your running the latest version of tekkit minecraft with java 8 and new version without messing up anything.

Now you might say, hey I have sensitive stuff and don't want to use Docker hub because its public, you can have your own registry with this:

docker run -p 5000:5000 registry

I want to have my own nagios server but it's hard to build, what can I do?

docker run -d -p 25 -p 80 quantumobject/docker-nagios

Hopefully someone can tell me why Docker or containers in general is not the way to go to run services :)

Enjoy more examples:

docker run --name some-nginx -d some-content-nginx
docker run --name some-redis -d redis
docker run --name some-mongo -d mongo
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql
docker run -d elasticsearch
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
1 points

Docker environment is very easy to set up and once its set up, its beyond easy to run all your services. Server is dead, easily redeploy your entire stack in seconds on a new server. The entire world is going containerization, this is a new tech that you want to learn for sure.

Look at every major company from Apple to Google to even Microsoft, they are all going containerization and there is a reason for that. Understand what containers are and why you will understand why any place with good engineers is switching to it. We are in an era of micro services and containers.

2 points

Wait what? lol How is docker not fit for one off services? As a DevOps engineer working for big financial company, we use Ansible. We have moved to Docker and Kuberentes and I can tear down our entire stack and rebuild it in less than 30 seconds. Even with Ansible that is not possible, we do still use it. I have a huge home lab and every application I run is in Docker. I can throw one of my servers out the windows and provision and deploy all my services using coreos and Docker. If you want to make a change to one of your services, you can test it out in Docker, commit the change to your own registry and swap out our old service with the new service in seconds.

You might want to look into Docker more before making such claims.

2 points

Are you going with multiple nodes? If no, then kubernetes is a waste. With docker alone, you can create different docker network interfaces to separate containers into different subnets.

1 points

Set up atomic OS, centos flavor. Build all your application in docker, if you have multiple server, art up kubernetes, which is built into atomic. If you can do this, you do even greater things.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.