Here are some sample answers to the questions presented in this chapter:
- The possible states of a Docker container are as follows:
- created: A container that has been created but not started
- restarting: A container that is in the process of being restarted
- running: A currently running container
- paused: A container whose processes have been paused
- exited: A container that ran and completed
- dead: A container that the Docker engine tried and failed to stop
- We can use docker container ls (or the old, shorter version, docker ps) to list all containers that are currently running on our Docker host. Note that this will NOT list the stopped containers, for which you need the extra parameter--all (or -a).
- To list all IDs of containers, running or stopped, we can use docker container ls -a -q, where -q stands for output ID only.