Docker Community Forums

Share and learn in the Docker community.

Can't find exit code of an exited service

Hi,

I’m facing a strange problem.
I have some services deployed with swarm and all was working fine. Two of them are databases containers.
For some reason, the 2 databases containers crashed. So I wanted to know why.
The ‘docker service ls’ command displays that the two containers are no longer running :

The ‘docker logs’ command does not give me any logs. So I tried the ‘docker ps’ command to see the exit reason, but this does not show the exited servcies ! Why ?

Well… So I tried to inspect the container, and this does not show the exit code either. It gives me :

[admin@impnode1 Install]$ sudo docker inspect cse7dfjqug7q --format '{{.State.ExitCode}}'
Template parsing error: template: :1:8: executing "" at <.State.ExitCode>: map has no entry for key "State"

Why can’t I retrieve this damn exit code ?