DEV Community

loading...

Error when trying to delete docker image

chanduthedev
I am a developer
・1 min read

When I try to remove docker image using docker rmi image-id, many times I got below error.
Error response from daemon: conflict: unable to delete e3c37a7601a1 (must be forced) - image is referenced in multiple repositories

Which means image was used by some other process.
But When I use docker ps to get docker process, got empty container list.

Follow below three steps to delete docker image if you get this error.

Step1. Use below command to show all container list.

docker ps -a

Step2. User below command to remove container

docker rm container-id

Step3. Use below command to remove docker image.
docker rmi image-id

Another way to delete docker unused containers.

This will delete all unused containers, networks, images (both dangling and unreferenced).

docker system prune

Be cautious while using this command as it will delete all containers.

Discussion (0)