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?
The docker logs command shows information logged by a running container. The docker service logs command shows information logged by all containers participating in a service. The information that is logged and the format of the log depends almost entirely on the container's endpoint command.
Each log file contains information about only one container and is in JSON format. Remember, one log file per container. You find these JSON log files in the /var/lib/docker/containers/ directory on a Linux Docker host.
When running Docker Engine in swarm mode, you can use docker stack deploy to deploy a complete application stack to the swarm. The deploy command accepts a stack description in the form of a Compose file. The docker stack deploy command supports any Compose file of version “3.0” or above.
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.
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