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?
Does "dead" mean that the container has been removed by docker rm
?
So will a dead container not be shown up by docker ps --all
?
Does "dead" mean that "A container that the daemon tried and failed to stop (usually due to a busy device or resource used by the container)"? I haven't found where that comes from. I am not sure that is correct, because can "failed to stop" mean the container is running?
Also does "exited" mean "A container that ran and completed"? If a container exits before completion due to error, what is its status?
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.