Docker Swarm

Initialize the swarm

docker swarm init --listen-addr 195.122.17.92:3000 --advertise-addr 10.10.0.6

We need the –advertise-addr because there are two IP addresses assigned to the same interface.

Create a service

docker service create --name my-service --publish 3000:3000 my-image:1.0.0

Set the service to be hosted on two nodes

docker service update --replicas 2 my-service

Leave a Reply

Your email address will not be published. Required fields are marked *