0
0
Dockerdevops~20 mins

System prune for cleanup in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker Cleanup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of the command docker system prune -f?
You run docker system prune -f on a system with unused containers, networks, images, and build cache. What will this command do?
Docker
docker system prune -f
AOnly shows what would be removed without actually deleting anything.
BRemoves only stopped containers and unused networks, but keeps images and build cache.
CRemoves all containers, including running ones, and all images.
DRemoves all stopped containers, unused networks, dangling images, and build cache without asking for confirmation.
Attempts:
2 left
💡 Hint
The -f flag forces the prune without confirmation.
Best Practice
intermediate
2:00remaining
Which option is the safest way to clean up unused Docker resources without affecting running containers?
You want to free disk space by removing unused Docker resources but must not stop or remove any running containers. Which command should you use?
Adocker system prune -f
Bdocker system prune -a -f
Cdocker container prune -f
Ddocker image prune -a -f
Attempts:
2 left
💡 Hint
Consider what resources each prune command affects.
Troubleshoot
advanced
2:00remaining
Why does docker system prune not remove some unused images?
You ran docker system prune -f but noticed some unused images remain. What is the most likely reason?
AThe command requires the <code>--all</code> flag to remove any images.
BThe images are corrupted and cannot be removed.
CThe images are tagged and not dangling, so they are not removed by default.
DDocker daemon is not running, so prune has no effect.
Attempts:
2 left
💡 Hint
Think about what 'dangling' means for images.
🔀 Workflow
advanced
3:00remaining
What is the correct sequence to safely clean up all unused Docker images, including untagged and tagged, without affecting running containers?
Arrange the following commands in the correct order to clean up all unused Docker images and other unused resources safely.
A1,3,2,4
B4,1,3,2
C1,2,3,4
D3,1,4,2
Attempts:
2 left
💡 Hint
Start by pruning containers and networks before images and system prune.
🧠 Conceptual
expert
2:00remaining
What is the effect of running docker system prune --volumes -f?
You execute docker system prune --volumes -f. What additional cleanup does this command perform compared to docker system prune -f?
AIt removes only volumes and leaves containers, networks, and images untouched.
BIt removes all unused volumes in addition to stopped containers, unused networks, dangling images, and build cache.
CIt removes volumes but requires confirmation even with <code>-f</code> flag.
DIt removes volumes only if they are attached to running containers.
Attempts:
2 left
💡 Hint
Volumes are not removed by default with system prune.