Docker Swarm

Initialize the swarm

docker swarm init --listen-addr --advertise-addr

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 *