I tried to create a container using the following
docker run -it centos bash
and exited without killing it.
Now I’m trying to delete the centos image using its image ID.
docker rmi -f 0f3e07c0138f
Error response from daemon: conflict: unable to delete 0f3e07c0138f (cannot be forced) - image is being used by running container a9eab034a426
On docker documentation page, it says ” You cannot remove an image of a running container unless you use the -f option.” but still I’m unable to remove image using -f. What can be the explanation for this? Should there a correction in documentation?
2
Answers
a9eab034a426
container is usingcentos
image. So, to removecentos
, you need to stop and removea9eab034a426
container. Run the following lines.See these results
docker rmi -f option only works on image name if container is running, even then it just untag the image but the image remains there with “none” repo and tag. see
And when you will run
you will see that image id is there instead of the image name
I have removed other info in this docker ps command’s result.