ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 269 - 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:

This command will remove all containers, regardless of their state, by passing the IDs of all containers to the docker rm command. The docker ps -aq command will list the IDs of all containers, including the ones in an exited state, and the $ ( ) syntax will substitute the output of the command as an argument for the docker rm command. This is a quick and easy way to clean up all containers, but it may also remove containers that are still needed or running.

Reference

docker rm | Docker Docs - Docker Documentation, section ''Remove all containers''

Docker Remove Exited Containers | Easy methods. - Bobcares, section ''For removing all exited containers''

asked 02/10/2024
Vasco Ricardo Ribeiro
30 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first