CompTIA Linux+ (XK0-005) — Question 101
A cloud engineer needs to remove all dangling images and delete all the images that do not have an associated container. Which of the following commands will help to accomplish this task?
Answer options
- A. docker images prune -a
- B. docker push images -a
- C. docker rmi -a images
- D. docker images rmi --all
Correct answer: A
Explanation
The correct command is 'docker images prune -a', which effectively removes all unused images, including dangling ones. The other options do not serve this purpose: 'docker push images -a' is incorrect as it attempts to push images, not delete them; 'docker rmi -a images' is not a valid command; and 'docker images rmi --all' is not a recognized syntax for removing images.