skip to Main Content

I was trying various options of "docker image history" command to see the image layers used to build the image on my local machine.

There is a nginx image on my system which has no tags assigned. So "docker images" command lists the following images in my system.

enter image description here

I tried to find layer details for nginx image using following command :

docker image history nginx

But as the tag name is not specified, docker-cli considers it default "latest" tag which is not present on my system and I am getting following error :

Error response from daemon: No such image: nginx:latest

I tried the same command with "none" as tag but it also failed with following error :

docker image history nginx:none
Error response from daemon: No such image: nginx:none

Any suggestions ? How can we see layers of an images which does not have tag assigned.

3

Answers


  1. Chosen as BEST ANSWER

    I found --filter option for docker images command which we can use to find dangling/untagged images as below :

    docker images -f "dangling=true" --quiet
    

    We can use this command to list image layers for the untagged image as below :

    docker image history  $(docker images -f "dangling=true" --quiet)
    

  2. Try using ID instead of name with tag.

    Let say that I have this output of docker images

    REPOSITORY TAG      IMAGE ID       CREATED      SIZE
    postgres   <none>   1f0815c1cb6e   7 weeks ago  314M
    

    I can use docker image history and specify the ID or part of it sufficient to identify the image in this context.

    docker image history 1f0
    
    Login or Signup to reply.
  3. docker history <your-docker-image-id>
    

    In your case it is as follows:

    docker history 7ce4f91ef623
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search