Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

List the Images on a Host

Both forms do the same thing; docker image ls is the newer name of the command:

docker images
docker image ls

Each line is one name and tag stored on this Docker host. Docker Engine 29 and later print a newer, grouped view by default, with different column names. The classic table, which older releases print and which you can rebuild with --format, has five columns:

ColumnMeaning
REPOSITORYThe image name
TAGThe version label
IMAGE IDShort content ID
CREATEDWhen it was built, not pulled
SIZESpace it needs, shared layers included

Two tags that point to the same build show the same IMAGE ID: they are one image with two names. The options below work in both views. How an image differs from the containers made from it is explained in Docker image vs container.

Show Only Some Images

Name a repository to list all of its tags, or use a filter:

docker images nginx
docker images --filter "reference=registry.example.com/shop/*"
docker images --filter "dangling=true"
FilterShows
dangling=trueImages without a name
reference=PATTERNNames that match
before=IMAGEOlder images
since=IMAGENewer images
label=KEY=VALUEImages with a label

Images Shown Without a Name

A line with <none> as both REPOSITORY and TAG is a dangling image. It appears when a name moves to a newer build: you pull nginx:alpine again or rebuild myapp:latest, the name goes to the new image, and the old one stays behind without a name. Since Docker Engine 29, the default listing hides untagged images; add -a to see them. Dangling images that no container uses can go:

docker image prune

With -a, docker images also lists intermediate images, also shown as <none>: on hosts that built images with the classic builder, the parent layers of those builds. They go with the image they belong to. BuildKit, the default builder today, keeps build steps in its build cache instead.

IDs, Digests, and Custom Output

docker images -q
docker images --digests nginx
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"
docker images --format "{{.Repository}}:{{.Tag}}"
  • -q: prints only image IDs, one per line, for use in other commands.
  • --digests: adds a DIGEST column, the sha256 hash of the image manifest. A tag can be moved to another build; a digest cannot. See docker tag.
  • --format: takes a Go template. The table prefix keeps the header line. Other fields include {{.ID}}, {{.CreatedSince}}, and {{.Digest}}.

Size and Shared Layers

Adding up the SIZE column overstates disk use. Images are built from layers, and images that start from the same base share those layers on disk: ten images based on debian:13 store the Debian layer once. For the real figures:

docker system df
docker system df -v

The first command sums images, containers, local volumes, and build cache, with a RECLAIMABLE column. The -v form lists every image with its shared and unique size. If the disk itself is filling up, start with how to check disk space in Linux.

See How an Image Was Built

docker history nginx:alpine
docker image inspect nginx:alpine

docker history lists the layers from newest to oldest, with the instruction that created each one and its size. docker image inspect prints the full metadata as JSON: environment variables, the default command, exposed ports, labels, and the CPU architecture.

Remove Images You No Longer Need

docker rmi myapp:old
docker image prune
docker image prune -a
  • docker rmi: removes one name. If other tags point to the same image, only that tag goes. Docker refuses to delete an image that a container uses, even a stopped one; remove the container first rather than forcing it with -f.
  • docker image prune: removes dangling images only.
  • docker image prune -a: removes every image that no container uses. The next start of a removed service has to pull or build it again.

More examples are in how to remove Docker images, and cleaning images, containers, networks, and build cache in one step is covered in docker system prune.

An Image You Expect Is Missing

Images belong to a Docker daemon, not to a user. If docker images and sudo docker images show different lists, you are talking to two daemons: usually a rootless Docker setup next to the system one. docker context ls marks the context the client uses with an asterisk, and the DOCKER_HOST variable overrides it when set. Podman keeps its own separate image store as well; see Podman vs Docker.

Was this answer helpful?
Loading...