Which command shows all containers, including those that have exited?

Study for the Kubernetes Cloud Native Associate (KCNA) Certification. Prepare with flashcards and multiple choice questions. Ensure success with detailed explanations. Ready for your exam!

Multiple Choice

Which command shows all containers, including those that have exited?

Explanation:
To see all containers, including those that have exited, you use the -a flag with the list command. Docker ps shows only currently running containers by default, so adding -a expands the view to include every container in any state (running, paused, exited, etc.). This is why the correct command is docker ps -a: it reveals the full set of containers and their final statuses, such as Exited, along with exit codes. If you’re using the newer CLI namespace, docker container ls -a is equivalent, but the essential concept is using -a to show all containers.

To see all containers, including those that have exited, you use the -a flag with the list command. Docker ps shows only currently running containers by default, so adding -a expands the view to include every container in any state (running, paused, exited, etc.). This is why the correct command is docker ps -a: it reveals the full set of containers and their final statuses, such as Exited, along with exit codes. If you’re using the newer CLI namespace, docker container ls -a is equivalent, but the essential concept is using -a to show all containers.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy