XK0-005 · Question #646
A cloud engineer wants to delete all unused networks that are not referenced by any container. Which of the following commands will achieve this goal?
The correct answer is C. docker network prune. 'docker network prune' removes all networks that are not currently used by at least one container. This is the correct cleanup command for orphaned networks. 'docker network erase' (A) and 'docker network clear' (B) are not valid Docker commands and will produce errors. 'docker…
Question
A cloud engineer wants to delete all unused networks that are not referenced by any container. Which of the following commands will achieve this goal?
Options
- Adocker network erase
- Bdocker network clear
- Cdocker network prune
- Ddocker network rm
How the community answered
(51 responses)- A2% (1)
- B6% (3)
- C90% (46)
- D2% (1)
Explanation
'docker network prune' removes all networks that are not currently used by at least one container. This is the correct cleanup command for orphaned networks. 'docker network erase' (A) and 'docker network clear' (B) are not valid Docker commands and will produce errors. 'docker network rm' (D) is a valid command but requires you to specify individual network names or IDs explicitly - it does not automatically identify and remove all unused networks. The 'prune' subcommand is Docker's standard mechanism for cleaning up unused resources (also available for images, containers, and volumes).
Topics
Community Discussion
No community discussion yet for this question.