I’ve had to brush up my Docker skills again due to some side projects I’m working on. So I ran into some basic issues I wanted to elaborate on. In this blog post: “image is referenced in multiple repositories.”
I had to remove a Docker image from my machine using the rmi command.
docker rmi <image_id>
To my surprise, I was unable to delete the image. The following error was thrown:
Error response from daemon: conflict: unable to delete <image ID> (must be forced) - image is referenced in multiple repositories
For example, this can happen when you have an image that is referenced by multiple tags or multiple names. In the following example, I created two mirrors of redis.
docker pull redis:latest docker tag redis:latest redis:my_new_tag docker tag redis:latest redis_mirror:latest
The result is:
When you try to remove the image by ID, Docker does not know which image (mirror) you are referring to. There are two ways one can tackle this.
Instead of trying to remove the image using its image id, you’ll have to remove all repositories individually, by referencing them with their name and tag. The last one can be removed by referring to the image ID.
docker rmi redis:my_new_tag rocker rmi redis_mirror docker rmi 881
But there is also a faster solution. You can force docker to remove an image. By using the -f flag and the image’s (short or long) ID, the image gets untagged and is removed. Like this:
docker rmi -f <image ID>
And that’s how it’s done.
Extremely helpful! I started playing with Docker almost a year ago before jumping into a new subject. I recently got back to my Docker study and wanted to start with a clean slate. But I was unable to remove several of the older images that were generated during my initial exploration. This concise post was helpful. Thanks!
thank you, didnt know kan remove images using repo-name:tag
It’s truly very complex in this active life to listen news on TV, therefore I
simply use the web for that purpose, and take the latest news.
I wanted to give a shout-out for your incredible website. The content is top-notch and has been a game-changer for me. Huge thanks for all your hard work!
http://mydiba.me/
دانلود فیلم از دیبا مووی
Thank you very much for sharing, I learned a lot from your article. Very cool. Thanks.