CodeBlanks Logo Icon CodeBlanks

docker images

Learn to list local images with docker images.

docker images

docker images (or docker image ls) lists the images in the local store: repository, tag, ID, creation time and size. If a repository name is given, only its images are shown:

$ docker images
REPOSITORY   TAG         IMAGE ID       CREATED        SIZE
api          1.2.0       4f1e2d3c4b5a   2 hours ago    162MB
nginx        alpine      a5b6c7d8e9f0   3 weeks ago    48MB
<none>       <none>      1a2b3c4d5e6f   3 hours ago    162MB
$ docker images nginx

Filtering and format

As in docker ps, --filter and --format work here too. To find dangling images and show only the wanted columns:

docker images --filter dangling=true
docker images --format '{{.Repository}}:{{.Tag}} {{.Size}}'
docker images -q          # only the IDs

Practice Filter the image list

Write two commands: list the dangling images; then print all images in the {{.Repository}}:{{.Tag}} format.

Starter code

terminal
# buraya yaz

Sample solution

terminal
docker images --filter dangling=true
docker images --format '{{.Repository}}:{{.Tag}}'

Expected output

REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
<none>       <none>    1a2b3c4d5e6f   3 hours ago   162MB
api:1.2.0
nginx:alpine
<none>:<none>

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What does an image shown as <none>:<none> mean?

  • An image being downloaded
  • A hidden image
  • A dangling image whose tag moved to a newer build Correct answer
  • A corrupt image

Explanation: Rebuilding with the same tag leaves the old image untagged.

2 Show only the dangling images.

Question
docker images --filter ____=true
Answer
docker images --filter dangling=true

Explanation: dangling=true selects untagged images.

3 Match.

Term Meaning
docker images Local image list
<none> Dangling image
-q Only IDs
SIZE Disk size

All lessons in Beginner