Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 772
FraK Avatar asked Mar 10 '19 12:03

FraK


People also ask

What do docker logs show?

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.

Where are docker Service logs located?

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.

What does docker stack deploy do?

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.


1 Answers

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.

like image 171
BMitch Avatar answered Sep 28 '22 03:09

BMitch