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?
Correct Answer: B
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.
References
* docker rm | Docker Docs - Docker Documentation, section "Remove all containers"
* Docker Remove Exited Containers | Easy methods. - Bobcares, section "For removing all exited containers"