Introduction
In this lab, we will dive into the mysterious world of Docker pruning with a setting inspired by the Victorian era. Our scene is set in the dimly lit streets of London, where a renowned detective is on the trail of unused Docker objects. The detective must navigate through the cluttered Docker containers and images to uncover hidden secrets of unused objects.
Initiating the Investigation
In this step, we guide the students through the process of identifying and removing unused Docker containers, images, volumes, and networks using the docker prune command.
First, let's ensure the docker environment is set up:
docker pull hello-world
Next, students are instructed to remove the unused Docker objects:
First, prepare the needed environment using the following commands:
docker container run hello-world docker network create example_network docker image pull alpine docker container run --name temp_container -d alpine sleep 1000Using the
docker prunecommand to remove images and network:docker stop temp_container docker rm temp_container docker image prune -a docker network prune
Confirming the Investigation
In this step, students will continue the investigation to ensure the unused Docker objects have been successfully pruned.
docker system prune -a
Summary
In this lab, you learned how to identify and remove unused Docker objects to free up disk space and improve system performance. You practiced using Docker prune commands to clean up dangling images, stopped containers, and unused networks. These skills will help you maintain clean and efficient Docker environments in your future projects.



