problem
docker images -a
1 | [root@CN-BJI-D-de9f66 ~]# docker images -a |
when put command docker rmi 820bc1802af7
, <none>:<none>
image delete fail.1
Error response from daemon: conflict: unable to delete 820bc1802af7 (cannot be forced) - image has dependent child images
this is cause by has other images depend on this image 820bc1802af7
.
use docker image inspect
, find current image’s child image, repository tag name.1
2[root@CN-BJI-D-de9f66 ~]# docker image inspect --format='{{.RepoTags}} {{.Id}} {{.Parent}}' $(docker image ls -q --filter since=820bc1802af7)
[tdtest:latest] sha256:e3ad759bb99351a4951df11113e0ad3914a26d55e99e5243e13ebac19373efae sha256:8abd1595d4dfc922b81825940c0f6d73034eeb10b3e2b12a78b3d0e33d78588e
mechanism
kind one
<none>:<none>
images which be related to the image be deleted will be deleted as will.
this kind of <none>:<none>
is middle image
, it won’t occupy space.
kind two
make a docker image docker build -t hello-world ./
1
2FROM centos:latest
RUN echo 'hello world'
when centos have a new release, build hello-world image again, it will depend on the latest centos.
the hello-world
depend on older centos, will become <none>:<none>
dangling image.
this kind of <none>:<none>
occupy space, it was originally tag image.
all docker file store at /var/lib/docker/graph
in default, docker be called graph layer database
.
use command docker rmi $(docker images -f "dangling=true" -q)
to delete wandering image layer.
other command
1 | # stop all container |
http://www.ibloger.net/article/3217.html
https://segmentfault.com/a/1190000011153919
https://blog.csdn.net/sin_geek/article/details/86736417