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

Prepare for the KCNA Certification Test. Study with flashcards, multiple-choice questions, and detailed explanations to enhance your understanding of Kubernetes Cloud Native concepts. Ace 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