1

I am using docker 1.12.5 as below:

$ docker --version
Docker version 1.12.5, build 7392c3b

I have below images:

$ docker images|grep 5000
hoth.southbanksoftware.com:5000/dbenvy-controller              <none>              d1e229866063        4 days ago          919.4 MB

I use below command to remove this image but failed:

$ docker rmi -f hoth.southbanksoftware.com:5000/dbenvy-controller
Error response from daemon: No such image: hoth.southbanksoftware.com:5000/dbenvy-controller:latest

It failed since the tag is not latest. Then I tried to remove it by id:

$ docker rmi -f d1e229866063
Error response from daemon: conflict: unable to delete d1e229866063 (cannot be forced) - image has dependent child images

it shows that there is dependent child images. Then how can I remove this image and its child images?

EDIT1

After following this link docker how can I get the list of dependent child images?, I did remove some images but below images still left and not able to delete.

$ docker images |grep 5000
hoth.southbanksoftware.com:5000/dbenvy-controller   <none>              4074bfc5705b        3 weeks ago         667.8 MB
hoth.southbanksoftware.com:5000/ubuntu_jdk8         <none>              4074bfc5705b        3 weeks ago         667.8 MB

Below is the child images of this image id 4074bfc5705b:

$ docker images --filter since=4074bfc5705b
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              315ce2f11b01        4 days ago          667.8 MB
mysql               latest              594dc21de8de        9 days ago          400.2 MB
mongo               latest              86e302671af4        3 weeks ago         401.9 MB

What I don't understand is that why mysql and mongo docker images are listed there. They were created by docker pull command directly. How come they become a child image?

Community
  • 1
  • 1
Joey Yi Zhao
  • 23,254
  • 37
  • 138
  • 276
  • 2
    look here - http://stackoverflow.com/questions/36584122/docker-how-can-i-get-the-list-of-dependent-child-images – JosMac Dec 23 '16 at 12:43
  • 1
    On a side note: I delete these images like this: `docker images -q -f dangling=true | xargs docker rmi` - this will query for all dangling images and then delete them one be one. – nwinkler Dec 23 '16 at 12:55
  • Possible duplicate of [How to remove old and unused Docker images](https://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images) – kenorb Apr 13 '18 at 00:25

1 Answers1

0

Docker images are created in layers, with each layer appearing as another image. You can run a docker inspect on the image you want to delete, and then run an inspect on other images on the same hosts to see which images are based on this unnamed image.

Note that this image could be something like Debian itself, with other images using it as the base. Also note that this image isn't taking up any space that wouldn't be taken by the child images, each layer only ever exists once on the drive.

BMitch
  • 148,146
  • 27
  • 334
  • 317
  • Thanks for your reply. Is there any direct way to find out the dependency image? I have more than 50 images on the host. Inspecting one by one takes a lot time. – Joey Yi Zhao Dec 26 '16 at 09:10
  • I know tools exist to generate a tree of all the images on a host. I've never gone down this path since there's really no value to it. Instead of trying to clean up anonymous image ids that are in use somewhere, directly clean the images you no longer need that have a tag, and any unused layers remaining will be automatically removed. – BMitch Dec 26 '16 at 13:07