Safe inventory and targeted cleanup
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Treat the worksheet as evidence to analyze, not a script to paste. Before any authorized observation confirm the actual endpoint, object identity, time window and output budget. Do not repair, restart or delete resources during this offline exercise.
Fictional inventory in approved lab context:container bm-demo-old: stopped, owner approved, no retained data, identity verifiedimage bm-release:previous: no running users, rollback retention activevolume bm-report-data: unattached, restore not verifiednetwork bm-lab-net: active dependencyStaged inventory only:docker --context bm-lab ps -adocker --context bm-lab image lsdocker --context bm-lab volume lsdocker --context bm-lab network lsdocker --context bm-lab system df -vCollect scoped inventory and check exact IDs, dependencies including stopped containers, retention and data ownership. The stopped demo container is a candidate for targeted removal only after rechecking context and approvals immediately before execution. Preserve the rollback image, unverified data volume and network with dependencies. Docker prune commands operate over classes of eligible resources, and filters and default volume behavior vary by command and version. Do not use blanket prune or force options here. If authorized in a disposable VM, a specific object removal command such as docker --context bm-lab container rm <verified-container-id> expresses scope; the placeholder is not executable and the lab does not remove anything. Verify remaining required objects and application health afterward. Report actual reclaimed storage only after measurement, not from a guessed sum of image sizes. The helper tests eligibility for further review, not real deletion authority or dependency discovery. The placeholder in the explanation is not a command to paste. Recheck retained volumes, stopped-container dependencies and rollback references; do not estimate reclaimed bytes from virtual image sizes.
Common mistake
Do not delete unattached volumes or retained rollback images simply because they are not currently in use.
Manual practice
Choose the only candidate for further approval. Run the local decision model and explain why it cannot authorize a real deletion.
Worksheet: lab-fixtures/docker-engine-administration/08-targeted-cleanup/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Safe inventory and targeted cleanup — Knowledge check
Interpret synthetic administration evidence and choose safe maintenance decisions.
Which fictional object qualifies only for further targeted-removal review?
Why preserve an unattached volume?
Why avoid broad prune in this exercise?