Search code examples
dockerdocker-swarmdocker-container

Can't list containers with manager node "Reachable", only with "Leader"


I worked with https://labs.play-with-docker.com.

I created a new service in one of the managers (not the leader):

docker service create --name example nginx  

When I ran:

docker container ls  

It didn't show me the containers:
enter image description here

But when I ran the same command on the manager leader node, it did:
enter image description here

Any explanation why is that ?


Solution

  • You have created a service that is replicated only once (one container), if you want a global service (a container in each VM) you have to add --mode global flag to you docker service create command, by the way you take a look at --replicas flag too : https://docs.docker.com/engine/swarm/services/