Recall & Review
beginner
What command is used to remove a Docker image by its image ID or name?
Use
docker rmi <image_id_or_name> to remove a Docker image.Click to reveal answer
beginner
What happens if you try to remove a Docker image that is currently used by a running container?
Docker will not allow removing an image if it is used by a running container. You must stop or remove the container first.
Click to reveal answer
intermediate
How can you force remove a Docker image even if it is used by stopped containers?
Use
docker rmi -f <image_id_or_name> to force remove the image even if it is used by stopped containers.Click to reveal answer
intermediate
How do you remove all unused Docker images (dangling images) at once?
Use
docker image prune to remove all dangling images that are not tagged or used by containers.Click to reveal answer
beginner
What is the difference between
docker rmi and docker image rm?Both commands do the same thing: remove Docker images.
docker rmi is a shortcut for docker image rm.Click to reveal answer
Which command removes a Docker image by its name or ID?
✗ Incorrect
docker rmi is used to remove images. docker rm removes containers, not images.
What must you do before removing an image used by a running container?
✗ Incorrect
You must stop or remove containers using the image before removing it.
How do you force remove a Docker image even if it is used by stopped containers?
✗ Incorrect
docker rmi -f forces removal of the image even if it is used by stopped containers.
Which command removes all dangling (unused) Docker images?
✗ Incorrect
docker image prune removes all dangling images that are not tagged or used.
What is the shortcut command to remove Docker images?
✗ Incorrect
docker rmi is a shortcut for docker image rm.
Explain how to safely remove a Docker image that is currently used by containers.
Think about container dependencies before deleting images.
You got /3 concepts.
Describe the difference between removing images normally and forcing their removal in Docker.
Consider what happens when containers depend on the image.
You got /3 concepts.