Challenge - 5 Problems
Docker Image Removal Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of removing a non-existent Docker image
What is the output when you run
docker rmi non_existent_image on a system where this image does not exist?Docker
docker rmi non_existent_imageAttempts:
2 left
💡 Hint
Think about what Docker does if the image name is not found locally.
✗ Incorrect
Docker will return an error message indicating that the image does not exist locally when you try to remove a non-existent image.
💻 Command Output
intermediate2:00remaining
Effect of force removing a Docker image
What happens when you run
docker rmi -f image_name if the image is currently used by a running container?Docker
docker rmi -f image_nameAttempts:
2 left
💡 Hint
Consider what the force flag does in Docker image removal.
✗ Incorrect
Using the force flag removes the image even if containers are using it, but running containers continue to run using the image layers already loaded.
❓ Configuration
advanced2:00remaining
Docker command to remove all dangling images
Which command correctly removes all dangling (unused) Docker images?
Attempts:
2 left
💡 Hint
Dangling images are those without tags and not used by any container.
✗ Incorrect
The command uses docker images filter to list dangling images and removes them by their IDs.
❓ Troubleshoot
advanced2:00remaining
Reason for failure when removing an image with dependent containers
You try to remove an image with
docker rmi image_name but get the error: conflict: unable to remove repository reference "image_name" (must force) - container 123abc is using its referenced image. What is the cause?Attempts:
2 left
💡 Hint
Think about what Docker protects when containers depend on images.
✗ Incorrect
Docker prevents removing images that are referenced by containers unless the force flag is used.
✅ Best Practice
expert3:00remaining
Best practice to safely remove unused Docker images in a CI/CD pipeline
In a CI/CD pipeline, which approach is safest to remove unused Docker images without affecting running containers or builds?
Attempts:
2 left
💡 Hint
Consider automated cleanup that avoids disrupting running containers.
✗ Incorrect
Using docker image prune with filters safely removes unused images older than a set time, avoiding impact on running containers.