6

https://docs.docker.com/engine/reference/commandline/ps/ says

status One of created, restarting, running, removing, paused, exited, or dead

What does "dead" status mean for a container?

halfer
  • 19,824
  • 17
  • 99
  • 186
Tim
  • 1
  • 141
  • 372
  • 590

1 Answers1

4

Just going by the documentation I could find:

"dead" is used for a "defunct" container; for example, a container that you wanted to remove but was only partially removed because resources were kept busy by an external process. Dead containers cannot be (re)started, only removed. You can manually attempt to remove a dead container (if the problem causing it to not be removed in the first attempt failed), and the daemon will automatically attempt to remove dead containers when it's restarted.

From Docker maintainer Sebastiaan van Stijn, https://github.com/docker/cli/issues/502#issuecomment-330361748 That is a pretty authoritative source on the matter, so it does look like the Stackoverflow answer you linked to was correct.

Does "dead" mean that the container has been removed by docker rm ?

docker rm was performed, but only partially succeeded, so it's still there, in that dead state.

And yes, they would show up in ps --all:

While reviewing the output of docker ps -a you may have seen both dead and exited statuses for containers. https://success.docker.com/article/what-is-the-difference-between-dead-and-exited-containers

If a container exits before completion due to error, what is its status?

Its status is "Exited" with the error code it returned, e.g. "Exited (1) 10 seconds ago". https://success.docker.com/article/what-is-the-difference-between-dead-and-exited-containers

Does "exited" mean "A container that ran and completed"?

Yes, the status includes the exit status code of the main process.

Community
  • 1
  • 1
Asik
  • 21,506
  • 6
  • 72
  • 131
  • Thanks. Does "exited" mean "A container that ran and completed"(https://stackoverflow.com/a/32428199/156458)? – Tim Apr 05 '19 at 01:57
  • Does "completed" mean exit with success? – Tim Apr 05 '19 at 02:26
  • You should ask the person who used that word what he meant by that. What the docker documentation clearly states is that exited does not necessarily mean exited with success. It can be any status code. – Asik Apr 05 '19 at 15:06