What is the command used to list all running containers on your machine?

Prepare for the Docker Foundations Test. Review essential Docker concepts with multiple choice questions, each with hints and explanations. Ace your exam!

The command used to list all running containers on your machine is "docker ps." This command is specifically designed to show you all currently active (running) containers along with their basic details, such as container IDs, names, status, and exposed ports.

This command is essential for managing and monitoring the containers in a Docker environment. By default, "docker ps" only shows the containers that are currently running, which allows you to keep track of active workloads without distraction from containers that are not running.

For contexts where you might want to see all containers, including those that are stopped, "docker ps -a" can be employed. However, the original command asked for specifically lists only the running ones.

The other choices do not serve this specific purpose: "docker images --containers" is not a valid command for listing containers but rather seems to suggest a way to list images. "docker search" is used for searching Docker Hub for images, and "docker list containers" does not exist as a command in Docker’s CLI. Thus, "docker ps" is the correct and most effective command for listing the running containers on your machine.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy