before the start
Why is there none
so named in the mirror?
These images docker called dangling mirror , when the mirror is covered by the new image, the old version of the image name will become none
.
The current docker host already exists nginx:latest
mirror, and shortly after docker hub
pushing a new version of nginx mirror.
When you re- docker pull nginx:latest
download image, the old version is covered with mirrored names will be transformed intonone
.
Another issue to note is introduced from the beginning docker 1.13.1 version docker image
command, a new command integrates list、rm、build、tag、push、pull
, and other functions, to replace images 、build 、rmi 、tag
and other two commands.
Considering the compatibility of the new version of the docker can still use these older two sub-commands, such as docker pull nginx
with docker image pull nginx
their functions are the same.
We need to do is to find and delete these names with none
invalid image.
Steps
- Lists with
none
mirrored character
docker images -f dangling=true | head -n 3
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> d31c5d38836d 3 days ago 1.03GB
<none> <none> 10d22b8d83b3 6 days ago 1.03GB
# 这两个命令功能相同
docker image ls -f dangling=true | head -n 3
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> d31c5d38836d 3 days ago 1.03GB
<none> <none> 10d22b8d83b3 6 days ago 1.03GB
- Remove the invalid Mirror
docker image prune
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y
Deleted Images:
deleted: sha256:d..省略..3e5c4918ee576d729a4b
# ...省略
- You can also use the command to delete rmi
docker rmi `docker image ls -f dangling=true -q`
Command Help
docker image
docker rmi -h
Flag shorthand -h has been deprecated, please use --help
Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
Remove one or more images
Options:
-f, --force Force removal of the image
--no-prune Do not delete untagged parents
summary
Finally, to sum up knowledge under article
- Dangling mirror , when the mirror is covered by the new image, the old version of the image name will become
none
. - You can use
docker image prune
the command to delete a mirror hanging pots. - For new students, although the old and the new command the same function, but it is recommended to use new commands to master.
doker&k8s Qun [703906133]