Docker Community Forums

Share and learn in the Docker community.

Why a new service creates a container in only 1 manager?

Good day.

I’m studying Docker Swarm and my personal lab has 3 managers and 2 workers. I’ve created an nginx service with docker service create --name web --publish 8080:80 nginx and while I can see it in every manager once I do docker service ls, I only can see its container with docker ps in manager 2. Why is that? In production what happens if that manager fail? Is that how’s supposed to go?

In fact when I do docker service update --replicas=4 web I see the 4 containers deployed 1 in every manager and 1 in one worker. And I’m a little lost here because I don’t know which thing goes into the managers and which on in workers. It would be awesome if anyone can enlight me here a little.

Thanks in advance.

Warm regards.


The managers are the only ones that can make changes to the service, but they will also work as normal workers, as services also will deploy to those (unless defined otherwise)

the reason you only see limited with “docker ps” is because docker ps is only the current node.

If you want to see how docker put your service:

docker service ps YOUR-SERVICE

if a manager fails, that role will be a assigned to another one of your managers.
Eventhough you have 3 managers, only 1 of them is THE manager

docker node ls

To see who is the current main-man

1 Like

Thank you very much @terpz :pray: