AICollection Help

docker images

The docker images command is used to list all the images on your local Docker host. It provides information about the images, such as their repository, tag, image ID, creation date, and size.

Basic Syntax

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

Key Options and Parameters

  1. -a, --all: Show all images (default hides intermediate images).

    docker images -a
  2. --digests: Show digests.

    docker images --digests
  3. -q, --quiet: Only show numeric IDs.

    docker images -q
  4. --filter: Filter output based on conditions provided.

    docker images --filter "dangling=true"
  5. --format: Pretty-print images using a Go template.

    docker images --format "{{.Repository}}: {{.Tag}}"

Examples

  1. List All Images

    docker images

    This command lists all images on the local Docker host.

  2. List All Images Including Intermediate Images

    docker images -a

    This command lists all images, including intermediate images used in the build process.

  3. List Only Image IDs

    docker images -q

    This command lists only the IDs of all images.

  4. Filter Images by Dangling Status

    docker images --filter "dangling=true"

    This command lists only the images that are not tagged and are not referenced by any container.

  5. Show Digests

    docker images --digests

    This command lists images along with their digests.

  6. Format Output

    docker images --format "{{.Repository}}: {{.Tag}}"

    This command formats the output to show only the repository and tag of each image.

Conclusion

The docker images command is useful for managing and inspecting Docker images on your local host. Understanding its options and parameters allows you to effectively list and filter images based on your needs.

Last modified: 05 December 2024