I'm playing Docker Swarm
, and using a docker-compose.yml
with docker deploy
. All services get deployed except for one, which stays in Pending state. I have added a constraint that ties this service to one of the nodes. My question is not so much about this particular problem, but more about how to troubleshoot. The Docker documentation mentions possible causes for a service to be in pending state, but none of those apply (constraint problem, resource drainage).
Can I see the docker swarm 'thought process' somewhere? What is it thinking?
Edit: should have made it more clear that I am using the new, 1.12-introduced, swarm option.
The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command. You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker or sudo service docker status , or checking the service status using Windows utilities.
You can check with this command systemctl status docker it will show the status of the docker. If you want to start you can use systemctl start docker instead of systemctl you can try also with service , service docker status and service docker start respectively.
Swarm mode has two types of services: replicated and global. For replicated services, you specify the number of replica tasks for the swarm manager to schedule onto available nodes.
I will explain how to debug when the service does not start as expected in the docker swarm mode.
First of all, get a task ID with docker service ps <service-name>
.
Next, it is useful to check meta data with docker inspect <task-id>
. In particular, Error message before container start is in the status field, and then reconfirm whether it was started with the intended parameters.
If the task has container ID, it was abnormally exited after starting the container, so check the log of the container with docker logs <container-id>
I hope this would be some of help.
docker run swarm
has a --debug
option which can tell you more.
See docker swarm issue 2341 or docker issue 24982 to see that option used to debug pending states.
For instance:
(unknown): 192.168.99.106:2375(node2 ip)
└ ID:
└ Status: Pending
└ Containers: 0
└ Reserved CPUs: 0 / 0
└ Reserved Memory: 0 B / 0 B
└ Labels:
└ Error: Cannot connect to the Docker daemon. Is the docker daemon running on this host?....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With