ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 169 - XK0-005 discussion

Report
Export

A Linux administrator found many containers in an exited state. Which of the following commands will allow the administrator to clean up the containers in an exited state?

A.
docker rm --all
Answers
A.
docker rm --all
B.
docker rm $(docker ps -aq)
Answers
B.
docker rm $(docker ps -aq)
C.
docker images prune *
Answers
C.
docker images prune *
D.
docker rm --state exited
Answers
D.
docker rm --state exited
Suggested answer: B

Explanation:

The command docker rm $(docker ps -aq) will allow the administrator to clean up the containers in an exited state. The docker command is a tool for managing Docker containers on Linux systems.

Docker containers are isolated and lightweight environments that can run applications and services without affecting the host system. Docker uses images to create containers, which are files that contain the code, libraries, dependencies, and configuration of the applications and services.

The rm option removes one or more containers. The $(docker ps -aq) is a command substitution that executes the command inside the parentheses and replaces it with the output. The docker ps -aq command lists all the containers, including the ones in an exited state, and shows only their IDs.

The docker rm $(docker ps -aq) command will remove all the containers, including the ones in an exited state, by passing their IDs to the rm option. This will allow the administrator to clean up the containers in an exited state. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not exist (docker rm --all or docker rm --state exited) or do not remove the containers (docker images prune *). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Cloud and Virtualization Technologies, page 571.

asked 02/10/2024
Junwei Li
37 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first