Docker is amazing! It is a gift to mankind. Next best thing after sliced bread! Lets start using it yeah. OK, lets say you want to get started with docker quickly and install a host of services on your local machine that enables you to get your big-data analytics SW into a real-time visualization. Don’t go about searching the net on how to install different servers. Instead, use Docker (I bet you knew this was coming)!
Docker runs great on Linux. Use:
sudo apt-get install docker docker-compose
if using a flavor of ubuntu/deb. Otherwise browse the web and get a package suitable for your distro. Make sure you have a proper HW to get about doing this. Once done, enable the docker service using:
sudo systemctl enable docker
That’s pretty much it. Now docker is running. The first thing one should do is to get the Simple Docker UI which takes away the burden of remembering all those commands. It is also available as a Google Chrome extension. Click on it and chrome downloads the application for you and creates a nice entry in your “start” (!!!) menu. Start the Simple Docker UI using:
sudo docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock uifd/ui-for-docker
If everything is installed OK, you can now open your browser to point to localhost:9000 and see a nice Docker UI. Play around with it but it is really simple to understand. The next step is to run some servers. An example can be a RabbitMQ server for instance. All the servers are available as either user-generated or official docker images on https://hub.docker.com/. Most have instructions on how to start the servers. But in this case, assume you need a RabbitMQ. The installation and default configuration of the server is as simple as:
sudo docker run -d -p 25672:25672 -p 4369:4369 -p 5671:5671 -p 5672:5672 --hostname mb-host rabbitmq:3.6.2
If you want to manage your RabbitMQ server so started with a nice RabbitMQ management plugin, start that up as well using:
sudo docker run -d -P --hostname mb-host rabbitmq:3.6.2-management
If data needs to be persisted across docker runs, create a volume and associate it with a directory on your local machine. Containers started by docker will then persist the data on that volume. You can look into docker UI to see which container is storing data where (I told you it is very simple). The following code creates a new data volume on /data/vidacdb with an associated mongoDB version and passes a true to allow persistence. We also start the docker-compose service just in case. Then we run an actual instance of mongoDB giving it the volume to use. Make sure we have the –smallfiles passed which helps by using less memory.
sudo docker create --name mongo-data-volume -v /data/vidacdb mongo:3.3.6 /bin/true
sudo docker-compose up -d
sudo docker run -d -p 27017:27017 --volumes-from mongo-data-volume mongo:3.3.6 --smallfiles
Thats pretty much it folks. You are up and running Docker. You can create your own docker images if need be. Run all the servers as needed, bunch them up as scripts and you are good to go. For me, I use the following bash script to run the needed servers.
#!/bin/bash # Start RabbitMQ from the official image https://hub.docker.com/_/rabbitmq/ # sudo docker run -d -p 25672:25672 -p 4369:4369 -p 5671:5671 -p 5672:5672 --hostname mb-host rabbitmq:3.6.2 # Also start the management plugin as needed # sudo docker run -d -P --hostname mb-host rabbitmq:3.6.2-management # Create a mongo-data-volume sudo docker create --name mongo-data-volume -v /data/vidacdb mongo:3.3.6 /bin/true sudo docker-compose up -d # Start MongoDB from the official image https://hub.docker.com/_/mongo/ # sudo docker run -v /data/vidacDB -d -p 27017:27017 mongo:3.3.6 sudo docker run -d -p 27017:27017 --volumes-from mongo-data-volume mongo:3.3.6 --smallfiles # --rest --auth # Start ElasticSearch needed for live data from official image https://hub.docker.com/_/elasticsearch/ sudo docker run -d -p 9200:9200 -p 9300:9300 elasticsearch:2.3.3 -Des.node.name="es_host" -Des.http.cors.enabled="true" -Des.http.cors.allow-origin:"/http?:\/\/localhost(:[0-9]+)?/" sleep 5 # Kibana from official https://hub.docker.com/_/kibana/ #4.5.1 sudo docker run --name local-kibana -e ELASTICSEARCH_URL=http://18.104.22.168:9200 -p 5601:5601 -d kibana:4.5.1 # Kibana from official https://hub.docker.com/_/kibana/ #4.5.1 # sudo docker run --name edm-kibana -e ELASTICSEARCH_URL=http://22.214.171.124:9200 -p 5610:5601 -d kibana:4.5.1 # Jenkins from official https://hub.docker.com/_/jenkins/ #1.651.3 sudo docker create --name jenkins-data-volume -v /data/jenkins_home jenkins:1.651.3 /bin/true sudo docker-compose up -d sudo docker run -v /data/jenkins_home -d -p 8080:8080 -p 50000:50000 jenkins:1.651.3