Automating Deployments Using Docker Stack
A docker-compose alternative for swarm cluster
We'll cover the following
In this lesson, we will automate all the steps we took to create and deploy our app using services.
Clone the project using
git clone https://github.com/venky8283/Docker.git
Typegit checkout fc0a9af7f7fb2c8d61e4777befdbf451568cf578
to get the exact code used in this lesson.
We did the same thing while working with docker-compose. In docker-compose, we created a docker-compose file and automated all the steps in it.
We will modify the same docker-compose file to run with docker-swarm because Compose and Docker stack are similar on some level.
Let’s list all the steps we need to automate as follows:
-
Pull the Flask_app v3.0 image from Docker Hub
-
Increase the number of replicas of the Flask app to three
-
Create a database service
-
Establish communication between services using the network
-
Create a visualizer service to monitor the swarm
Docker stack implementation
Docker stack is a bundle of services. When you want to deploy a set of services to a machine, instead of creating each service separately, Docker stack allows users to deploy the full-stack of the services at once.
Let’s see changes in our docker-compose file below.
Get hands-on with 1400+ tech skills courses.