SoFunction
Updated on 2025-04-07

Docker tag displays none image processing solution

Docker tag displays none image processing

In Docker, sometimes you seeREPOSITORYandTAGAll displayed as<none>mirror images, these are called "dangling images", that is, hanging images.

These images are usually because they have no tags and are not used by any container.

Here are some things about why it appears<none>Mirroring and information about how to process them:

Why does the <none> mirror appear?

  • When a new Docker image is built and the specified tag is duplicated with the local existing image, Docker replaces the tag of the old image with<none>, making the old mirror a suspended mirror.
  • During the Docker build process, if a step fails, Docker may leave an empty image, which is also<none>A source of mirroring.
  • If you usedocker saveWhen saving the image, the image name and label are not specified, but the image ID is used, so load (docker load) After this mirror, itsREPOSITORYandTAGIt will become<none>
  • If you force delete the image that is being used by the container, the image will also become<none>

How to use <none> mirror?

  • Normally, you shouldn't use<none>Mirrors, because they may be intermediates in the construction process or old mirrors that are no longer needed.
  • if<none>The mirror is referenced by any container, and you can still use these containers, but you cannot reference these images by the original tag.

How to deal with <none> mirroring?

You can use

docker images -f "dangling=true" 

Command to find all hanging images.

[root@tgq207 ~]# docker images -f "dangling=true" 
REPOSITORY           TAG       IMAGE ID       CREATED       SIZE
prom/node-exporter   <none>    1dbe0e931976   2 years ago   20.9MB

use

docker rmi $(docker images -f "dangling=true" -q) 

Command to delete these hanging images and free up space.

[root@tgq207 ~]# docker rmi $(docker images -f "dangling=true" -q)
Error response from daemon: conflict: unable to delete 1dbe0e931976 (cannot be forced) - image is being used by running container 103762bbd6d7

If the display is being used, it needs to be retained<none>Mirror, you can specify new tags for them

docker tag 1dbe0e931976 prom/node-exporter:latest

Summarize

The above is personal experience. I hope you can give you a reference and I hope you can support me more.