Docker虚悬镜像:仓库名、标签都是的镜像

虚悬镜像

虚悬镜像就是仓库名、标签都是<none>的镜像,俗称dangling image。

人为写一个(啥也不干):

Dockerfile

from ubuntu
CMD echo 'action is success'

build

[root@localhost ~]# docker build .
Sending build context to Docker daemon 499.4MB
Step 1/2 : from ubuntu
---> ba6acccedd29
Step 2/2 : CMD echo 'action is success'
---> Running in 5e30fa475ddb
Removing intermediate container 5e30fa475ddb
---> b5289e7f8a2a
Successfully built b5289e7f8a2a

查看镜像:

[root@localhost ~]# docker images
REPOSITORY                        TAG              IMAGE ID       CREATED          SIZE
<none>                            <none>           b5289e7f8a2a   8 seconds ago    72.8MB
mycentos7-java8                   1.1              d5c40a3c68ec   13 minutes ago   770MB

查看所有虚悬镜像:

[root@localhost ~]# docker images -f dangling=true   
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
<none>       <none>    b5289e7f8a2a   2 minutes ago   72.8MB

删除所有虚悬镜像:

[root@localhost ~]# docker images -f dangling=true   
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
<none>       <none>    b5289e7f8a2a   2 minutes ago   72.8MB
[root@localhost ~]# 
[root@localhost ~]# docker image prune
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y
Deleted Images:
deleted: sha256:b5289e7f8a2a187a576679b3a5af56f2f7fe1e61f023e10644cd80dea02bc87d

Total reclaimed space: 0B
[root@localhost ~]# 
[root@localhost ~]# docker images -f dangling=true
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@localhost ~]#

 

 

 

版权声明:
作者:admin
链接:https://www.chenxie.net/archives/2627.html
来源:蜀小陈
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录