Getting Started with Docker Services
Explore how to get started with Docker services within a Swarm environment. This lesson guides you through initializing a swarm, creating service containers for a Flask app and MySQL database, and connecting them with an overlay network to enable seamless communication. You will also learn how to update services to work within the swarm cluster effectively.
We'll cover the following...
Let’s start with the smallest component of Docker swarm which is Docker services.
Initializing the swarm node
If you are using the Docker Desktop for Windows or for Mac, the Docker swarm comes prebuilt. You can check that using docker swarm. To initialize the swarm mode, type docker swarm init.
$ docker swarm init
Swarm initialized: current node (ayxwwpio1sksk5hi2bdqxanf4) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-19vn56bmfcc2l20jmts9gg9b152vkn47ruu6vtfwgsl3646ha2-8lcseq2vaegpjqytnnw1xgksn 192.168.65.3:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
The node you started will be a manager node. We can add other machines or hosts to this swarm network using the command above with the provided token. But for now, we will see all the ...