Ben Davis
Ben Davis

Reputation: 13810

Docker container not created after stack deploy. Where can I find error logs?

I have a single-node swarm. My stack has two services. I deployed like so:

$ docker stack deploy -c /tmp/docker-compose.yml -c /tmp/docker-compose-prod.yml ide-controller"
Creating network ide-controller_default
Creating service ide-controller_app
Creating service ide-controller_traefik

No errors. However, according to docker ps, only one container is created. The ide-controller_traefik container was not created.

When I check docker stack services, it says 0/1 for the traefik container:

ID             NAME                     MODE         REPLICAS   IMAGE                                       PORTS
az4n6brex4zi   ide-controller_app       replicated   1/1        boldidea.azurecr.io/ide/controller:latest
1qp623hi431e   ide-controller_traefik   replicated   0/1        traefik:2.3.6                               *:80->80/tcp, *:443->443/tcp

Docker service logs has nothing:

$ docker service logs ide-controller_traefik -n 1000
$

There are no traefik containers in docker ps -a, so I can't check logs:

$ docker ps -a                                                                                                                                                                                                                                                          
CONTAINER ID   IMAGE                                       COMMAND                  CREATED         STATUS         PORTS      NAMES                                                                                                                                                         
922fdff58c25   boldidea.azurecr.io/ide/controller:latest   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes   3000/tcp   ide-controller_app.1.py8jrtmufgsf3inhqxfgkzpep

How can I find out what went wrong or what is preventing the container from being created?

Upvotes: 2

Views: 1934

Answers (2)

Hamidreza Vakilian
Hamidreza Vakilian

Reputation: 860

Restarting the docker might help, if there's no error displayed when running docker service ps <stack_name>

 sudo systemctl restart docker

Upvotes: 0

Chris Becke
Chris Becke

Reputation: 36026

docker service ps <service-name/id> has an error column that can expose errors encountered by libswarm trying to create containers, such as bad image names. Or, for a more detailed look, docker service inspect <service-name/id> has the current, and previous, service spec, as well as some root level nodes that will trace the state of the last operation and its message.

Upvotes: 3

Related Questions