Docker swarm

Swarm engine has been integrated in the new version of docker and does not need additional installation

docker swarm init --advertise-addr

Use the command prompted above to join to the cluster on node 2

docker swarm join --token SWMTKN-1-42oor9ruw9jv0bqw7vqmm6c29jwo5mnf34xvfn9iwojpor8c4q-bbxltikj5m5r1fnkhezlhjkts

Now you can see that there are two nodes in the cluster

Create an overlay network

docker network create --driver overlay --opt encrypted --subnet ol_net --attachable

Start nginx service

Finally, I start a Ubuntu container. You can see that this container on node 1 can ping nginx on node 1 and node 2 at the same time

Send a Message