CompTIA Linux+ (XK0-005) — Question 242
An administrator would like to list all current containers, regardless of their running state. Which of the following commands would allow the administrator to accomplish this task?
Answer options
- A. docker ps -a
- B. docker list
- C. docker image ls
- D. docker inspect image
Correct answer: A
Explanation
The correct command is 'docker ps -a', which lists all containers, including those that are stopped. The other options do not provide the desired output; 'docker list' is not a valid Docker command, 'docker image ls' lists Docker images instead of containers, and 'docker inspect image' is used to retrieve detailed information about a specific image.