Do you want to learn Docker FOR FREE OF COST? Yes, you read it correct. Thanks to a playground called “ play-with-docker “ — PWD in short. PWD is a website which allows you to create 5 instances to play around with Docker & Docker Swarm Mode for 4 hours — all for $0 cost. It is a perfect tool for demos, Meetups, beginners & advanced level training. I tested it on number of web browsers like Chrome, Safari, Firefox and IE and it just works flawlessly. You don’t need to install Docker as it comes by default. It’s ready-to-use platform.
Currently, PWD is hosted on AWS instance type 2x r3.4xlarge having 16 cores and 120GB of RAM. It comes with the latest Docker 17.05 release, docker-compose 1.11.1 & docker-machine 0.9.0-rc1. You can setup your own PWD environment in your lab using this repository. Credits to Docker Captain — Marcos Nils & Jonathan Leibuisky for building this amazing tool for Docker Community. But one of the most interesting fact about PWD is its based on DIND (Docker-in-a-Docker) concept. When you are playing around with PWD instances & building application stack, you are actually inside Docker container itself. Interesting, isn’t it? PWD gives you an amazing experience of having a free Alpine Linux 3.5 Virtual Machine in the cloud where you can build and run Docker containers and even create Multi-Node Swarm Mode Cluster.
Said that, PWD is NOT just a platform for beginners. Today, it has matured enough to run sophisticated application stack on top of it. Within seconds of time, you can setup Swarm Mode cluster running application stack.Please remember that PWD is just for trying out new stuffs with Docker and its application and NOT to be used for production environment. The instances will vanish after 4:00 hours automatically.
Under this blog post, I am going to showcase 3 out of 5 cool Dockerized application stack which you can demonstrate to the advance level audience all running on PWD playground (listed below):
Docker UI Management & Local Registry Service
Building Monitoring Stack with Prometheus & Grafana:
Demonstrating Voting Application under Swarm Mode
Highly Available Web Application
To make it quite simple, I have collected the list of sample application under https://github.com/ajeetraina/docker101
You can use
git clone to pull the repository on the manager node:
First, we need to setup Swarm Mode cluster on PWD. As Docker 17.05 already comes installed by default, we are all set to initialize the swarm mode cluster. Click on “New Instance” button on the left hand side of PWD and this will open up an instance on the right side as shown.Run the below command on the 1st instance as shown below:
$docker swarm init -advertise-addr :2377 -listen-addr :2377
This command will initialize the Swarm and suggest a command to join the worker node as shown:
$docker swarm join -token :2377
Once you run the command on all the 4 worker nodes. You can go back to manager node and check the list of Swarm nodes:
1. Docker UI Management & Local Registry Service:
Setting up Portainer for Swarm Mode Cluster
It’s time to get started with our first application — Portainer. Portainer is an open-source lightweight management UI which allows you to easily manage your Docker host or Swarm cluster. Run the below command to setup Portainer for Swarm Mode cluster:
Ensure that portainer is up and running:
The moment Portainer service gets started, PWD displays 9000 port which Portainer works on as shown. You can click on this port number to directly open the Management UI.
This opens up a fancy UI which displays lots of management features related to image, container, swarm, network, volumes etc.
Portainer clearly displays the swarm cluster as shown:
Setting up Portus for Local Docker Registry:
Portus is an authorization service for your Docker registry. It provide a useful and powerful UI on top of your registry. To test driver Portus, one need to clone the repository:
Run the below script with your manager IP to get Portus up and running:
Once this looks good, you should be able to browse its UI as shown:
I faced the issue related to Webpack::Rails::Manifest::ManifestLoadError which I got it fixed within few minutes. You now have control over Docker registry using this fancy UI. You can create Users, Organization for your development team and push/pull Docker images privately.
Hence, you can now open up Portainer and provide Portus as a local Docker registry instead of standard Docker registry. This makes Portainer & Portus work together flawlessly.
2. Building Monitoring Stack with Prometheus & Grafana
Prometheus is an open-source systems monitoring and alerting toolkit. Most Prometheus components are written in Go while some written in Java, Python, and Ruby. It is designed for capturing high dimensional data. It is designed to be used for monitoring. On the other hand, ELK is a general-purpose NOSQL stack that is also very popular for mo nitoring and Logging.
To test-drive Prometheus & ELK, you can change the directory to /play-with-docker/docker-prometheus-swarm directory and run the stack deploy command as shown below:
$docker stack deploy -c docker-compose.yml myprom1
[ A Special Credits to Basi for building https://github.com/bvis/docker-prometheus-swarm repository & tremendous effort for enabling this solution]
That’s it. Your Prometheus, Grafana & cadvisor for ELK stack is ready to be used.
Demonstrating Voting Application under Swarm Mode
Voting app is a perfect piece of example where it showcase dependencies among the services, and a potential division of services between the manager and worker nodes in a swarm. You can learn more about voting app and how it actually works under this link. To quickly demonstrate it, let us pick up the right directory under the pulled repository:
Run the below command:
$docker stack deploy -c docker-stack.yml myvotingapp
Did you find this blog helpful? Feel free to share your experience. Get in touch @ajeetsraina.
If you are looking out for contribution, join me at Collabnix Community Slack
Did you find this article valuable?
Support Collabnix by becoming a sponsor. Any amount is appreciated!