-1

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.

Gunjan Shah
  • 5,088
  • 16
  • 53
  • 72

3 Answers3

1

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
Michal Rosenbaum
  • 1,801
  • 1
  • 10
  • 18
1
docker history <your-docker-image-id>

In your case it is as follows:

docker history 7ce4f91ef623
Ashok
  • 3,190
  • 15
  • 31
0

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)
Gunjan Shah
  • 5,088
  • 16
  • 53
  • 72