Docker images command

Docker command reference


docker imagesThe command is used to list local Docker images.

Throughdocker imagesWith the command, users can view detailed information of all downloaded or built Docker images, such as repository name, tag, image ID, creation time, and size.

Syntax

docker images [OPTIONS] [REPOSITORY[:TAG]]

OPTIONS description:

  • -a, --all: Show all images (including intermediate images).
  • --digests: Display digest information of images.
  • -f, --filter: Filter the output based on the provided conditions.
  • --format: Format the output using a Go template.
  • --no-trunc: Display full image IDs.
  • -q, --quiet: Display only image IDs.

: List all local images:

docker images

: List images with digest information:

docker images --digests

List all images (including intermediate images):

docker images --all

: List images using filters:

docker images --filter "dangling=true"

: Display only image IDs:

docker images --quiet

: Output using a custom format:

docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.Size}}"

Example

: View the local image list:

example@example:~$ docker images
REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
mymysql                 v1                  37af1236adef        5 minutes ago       329 MB
example/ubuntu           v4                  1c06aa18edee        2 days ago          142.1 MB
<none>                  <none>              5c6e1090e771        2 days ago          165.9 MB
httpd                   latest              ed38aaffef30        11 days ago         195.1 MB
alpine                  latest              4e38e38c8ce0        2 weeks ago         4.799 MB
mongo                   3.2                 282fd552add6        3 weeks ago         336.1 MB
redis                   latest              4465e4bcad80        3 weeks ago         185.7 MB
php                     5.6-fpm             025041cd3aa5        3 weeks ago         456.3 MB
python                  3.5                 045767ddf24a        3 weeks ago         684.1 MB
...

List local images whose REPOSITORY is ubuntu:

root@example:~# docker images  ubuntu
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
ubuntu              14.04               90d5884b1ee0        9 weeks ago         188 MB
ubuntu              15.10               4e3b13c8a266        3 months ago        136.3 MB

: Output with digest information:

docker images --digests

Output:

REPOSITORY          TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
ubuntu              latest              sha256:8c53f09a9c6f1e85e10a8ffb649dd9de28b9be4994e792bd96fca152527bba03   2d13d07a40a3        2 weeks ago         72.9MB
nginx               stable              sha256:1c4f40db5d1c8e5e09d28e501ad167d7c2d91b8908f6f1d9c97d1c67c5f9a69b   5a34e9e5d33b        3 weeks ago         133MB
hello-world         latest              sha256:feda4427b0b5d9d84545dcb38e736a5226e5bb6228c61b0b6b28cb7483a14b68   feb5d9fea6a5        4 weeks ago         13.3kB

: Output using filters:

docker images --filter "dangling=true"

Example output:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              7db03500db4f        5 weeks ago         65.3MB

: Custom format output:

docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}\t{{.Size}}"

Output:

REPOSITORY          TAG                 IMAGE ID            SIZE
ubuntu              latest              2d13d07a40a3        72.9MB
nginx               stable              5a34e9e5d33b        133MB
hello-world         latest              feb5d9fea6a5        13.3kB

Common Scenarios

  • Manage Images: List local images to understand the currently available images.
  • Filter Images: Use filter options to find images with specific conditions, such as dangling images (untagged images).
  • : Image ID management.: Only obtain the image ID for subsequent operations, such as deleting an image.

docker imagesThe command is a very basic and important command in Docker image management. Through this command, users can view detailed information of all local images, and manage and maintain images. By using various options and formats, they can flexibly filter and format output to meet different management needs.


Docker command reference

other extensions