dockerloggingdocker-swarm-mode

Docker logs/errors of services of stack deploy


I am deploying a service(s) using swarm stack deploy. I am not able to deploy to other nodes, I wanna see what's wrong but have no way to see the logs of the services/tasks running on those nodes.

I tried

docker stack ps stackname

, which shows something under the "ERROR" column, such as "No such image", and "no suitable node", but I wanna see the full log of what is going on, otherwise seems impossible to solve any issues.

I also tried

docker service logs serviceid

but shows nothing.

Finally I also tried:

journalctl -fu docker.service

on the remote node, but it doesn't help too much, for example I cannot see the: "no suitable node" error there. Is there a way to see the logs/errors?


Solution

  • You can use docker inspect on a task id to see any errors scheduling or starting the task. Use docker service ps on the service name, or docker stack ps on the stack name, to get the task id.

    If the task gets scheduled, them an inspect in the container id will give details on why it stopped in the status section and container/service logs will show any output from your application. But if your task never starts, there won't be any container/service logs to view.