LinuxCommandLibrary

docker-image-ls

List local Docker images

TLDR

List all Docker images

$ docker [[images|image ls]]
copy

List all Docker images including intermediates
$ docker [[images|image ls]] [[-a|--all]]
copy

List the output in quiet mode (only numeric IDs)
$ docker [[images|image ls]] [[-q|--quiet]]
copy

List all Docker images not used by any container
$ docker [[images|image ls]] [[-f|--filter]] dangling=true
copy

List images that contain a substring in their name
$ docker [[images|image ls]] "[*name*]"
copy

Sort images by size
$ docker [[images|image ls]] --format "\{\{.ID\}\}\t\{\{.Size\}\}\t\{\{.Repository\}\}:\{\{.Tag\}\}" | sort [[-k|--key]] 2 [[-h|--human-numeric-sort]]
copy

SYNOPSIS

docker image ls [OPTIONS] [REPOSITORY[[:TAG]]]

PARAMETERS

-a, --all
    Show all images (default hides dangling and intermediate images)

--digests
    Show digests

-f, --filter filter
    Filter output based on conditions: dangling=true, label=<key>, label=<key>=<value>, reference, before=<id/image>, since=<id/image>

--format string
    Pretty-print images using a Go template

--no-trunc
    Don't truncate output

-q, --quiet
    Only show numeric IDs

DESCRIPTION

The docker image ls command displays a list of Docker images stored on the local host. It provides essential information such as repository name and tag, image ID (truncated by default), creation date, virtual size, and unique size. By default, it shows only top-level images, omitting intermediate layers from builds and dangling images (untagged and unreferenced).

This command is crucial for image management workflows, helping users identify available images before pulling new ones, inspecting details, or removing unused images to free disk space. Filters allow narrowing results by labels, references, or timestamps, while formatting options enable custom output via Go templates. Quiet mode outputs only image IDs for scripting. An alias docker images provides identical functionality.

Output is tabulated for readability, with columns for repository, tag, ID, created time, and size metrics reflecting shared layer efficiencies.

CAVEATS

Positional arguments filter by repository and optional tag; use quotes for multi-word filters. Dangling images are shown only with -a. Sizes account for layer sharing.

DEFAULT OUTPUT COLUMNS

TABLE: REPOSITORY | TAG | IMAGE ID | CREATED | SIZE
HEADERS: Repo/tag identifier, truncated ID, relative creation time, virtual size (including shared layers).

EXAMPLES

docker image ls — List top-level images.
docker image ls -a — Include all images.
docker image ls --filter reference=nginx — Filter by reference.
docker image ls -q — IDs only for scripting.

HISTORY

Introduced as docker images in Docker 0.6.5 (2013); subcommand docker image ls added in Docker 1.13 (2017) with CLI restructuring for extensibility.

SEE ALSO

docker(1), docker-image-inspect(1), docker-image-rm(1), docker-container-ls(1), docker-images(1)

Copied to clipboard