What command is used to remove all inactive Docker containers?

Prepare for the Cisco Certified DevNet Associate Exam. Use flashcards and multiple choice questions to boost your knowledge, with hints and explanations to guide you. Ace your exam effectively!

The command to remove all inactive Docker containers is indeed "docker container prune." This command is designed specifically to clean up unused containers that are in an inactive state, meaning they are not running.

When executed, "docker container prune" prompts the user to confirm that they want to delete all stopped containers, which helps in managing system resources and maintaining a clean working environment by removing containers that are no longer in use. This command is efficient as it eliminates the need to manually list and remove each stopped container individually.

In contrast, the other options do not achieve the same result. The "docker container rm" command is used to remove specified containers, but it must be followed by specific container IDs or names and does not target all inactive containers automatically. "Docker container clear" and "docker container delete" are not valid Docker commands, which makes them ineffective in this context. Therefore, understanding the purpose and functioning of "docker container prune" is crucial for efficient Docker container management.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy