mirror of https://github.com/docker/docs.git
81 lines
5.3 KiB
YAML
81 lines
5.3 KiB
YAML
command: docker image ls
|
|
aliases: images, list
|
|
short: List images
|
|
long: "This command lists the images stored in the local Docker repository.\n\nBy
|
|
default, intermediate images, used during builds, are not listed. Some of the\noutput,
|
|
e.g., image ID, is truncated, for space reasons. However the truncated\nimage ID,
|
|
and often the first few characters, are enough to be used in other\nDocker commands
|
|
that use the image ID. The output includes repository, tag, image\nID, date created
|
|
and the virtual size.\n\nThe title REPOSITORY for the first title may seem confusing.
|
|
It is essentially\nthe image name. However, because you can tag a specific image,
|
|
and multiple tags\n(image instances) can be associated with a single name, the name
|
|
is really a\nrepository for all tagged images of the same name. For example consider
|
|
an image\ncalled fedora. It may be tagged with 18, 19, or 20, etc. to manage different\nversions.\n\n##
|
|
Filters\n\nFilters the output based on these conditions:\n\n - dangling=(true|false)
|
|
- find unused images\n - label=<key> or label=<key>=<value>\n - before=(<image-name>[:tag]|<image-id>|<image@digest>)\n
|
|
\ - since=(<image-name>[:tag]|<image-id>|<image@digest>)\n\n## Format\n\n Pretty-print
|
|
images using a Go template.\n Valid placeholders:\n .ID - Image ID\n .Repository
|
|
- Image repository\n .Tag - Image tag\n .Digest - Image digest\n .CreatedSince
|
|
- Elapsed time since the image was created\n .CreatedAt - Time when the image
|
|
was created\n .Size - Image disk size\n\n# EXAMPLES\n\n## Listing the images\n\nTo
|
|
list the images in a local repository (not the registry) run:\n\n docker image
|
|
ls\n\nThe list will contain the image repository name, a tag for the image, and
|
|
an\nimage ID, when it was created and its virtual size. Columns: REPOSITORY, TAG,\nIMAGE
|
|
ID, CREATED, and SIZE.\n\nThe `docker image ls` command takes an optional `[REPOSITORY[:TAG]]`
|
|
argument\nthat restricts the list to images that match the argument. If you specify\n`REPOSITORY`but
|
|
no `TAG`, the `docker image ls` command lists all images in the\ngiven repository.\n\n
|
|
\ docker image ls java\n\nThe `[REPOSITORY[:TAG]]` value must be an \"exact match\".
|
|
This means that, for example,\n`docker image ls jav` does not match the image `java`.\n\nIf
|
|
both `REPOSITORY` and `TAG` are provided, only images matching that\nrepository
|
|
and tag are listed. To find all local images in the \"java\"\nrepository with tag
|
|
\"8\" you can use:\n\n docker image ls java:8\n\nTo get a verbose list of images
|
|
which contains all the intermediate images\nused in builds use **-a**:\n\n docker
|
|
image ls -a\n\nPreviously, the docker image ls command supported the --tree and
|
|
--dot arguments,\nwhich displayed different visualizations of the image data. Docker
|
|
core removed\nthis functionality in the 1.7 version. If you liked this functionality,
|
|
you can\nstill find it in the third-party dockviz tool: https://github.com/justone/dockviz.\n\n##
|
|
Listing images in a desired format\n\nWhen using the --format option, the image
|
|
command will either output the data \nexactly as the template declares or, when
|
|
using the `table` directive, will \ninclude column headers as well. You can use
|
|
special characters like `\\t` for\ninserting tab spacing between columns. \n\nThe
|
|
following example uses a template without headers and outputs the ID and \nRepository
|
|
entries separated by a colon for all images:\n\n docker images --format \"{{.ID}}:
|
|
{{.Repository}}\"\n 77af4d6b9913: <none>\n b6fa739cedf5: committ\n 78a85c484bad:
|
|
ipbabble\n 30557a29d5ab: docker\n 5ed6274db6ce: <none>\n 746b819f315e:
|
|
postgres\n 746b819f315e: postgres\n 746b819f315e: postgres\n 746b819f315e:
|
|
postgres\n\nTo list all images with their repository and tag in a table format you
|
|
can use:\n\n docker images --format \"table {{.ID}}\\t{{.Repository}}\\t{{.Tag}}\"\n
|
|
\ IMAGE ID REPOSITORY TAG\n 77af4d6b9913 <none>
|
|
\ <none>\n b6fa739cedf5 committ latest\n
|
|
\ 78a85c484bad ipbabble <none>\n 30557a29d5ab docker
|
|
\ latest\n 5ed6274db6ce <none> <none>\n
|
|
\ 746b819f315e postgres 9\n 746b819f315e postgres
|
|
\ 9.3\n 746b819f315e postgres 9.3.5\n
|
|
\ 746b819f315e postgres latest\n\nValid template placeholders
|
|
are listed above.\n\n## Listing only the shortened image IDs\n\nListing just the
|
|
shortened image IDs. This can be useful for some automated\ntools.\n\n docker
|
|
image ls -q\n"
|
|
usage: docker image ls [OPTIONS] [REPOSITORY[:TAG]]
|
|
pname: docker image
|
|
plink: docker_image.yaml
|
|
options:
|
|
- option: all
|
|
shorthand: a
|
|
default_value: "false"
|
|
description: Show all images (default hides intermediate images)
|
|
- option: digests
|
|
default_value: "false"
|
|
description: Show digests
|
|
- option: filter
|
|
shorthand: f
|
|
description: Filter output based on conditions provided
|
|
- option: format
|
|
description: Pretty-print images using a Go template
|
|
- option: no-trunc
|
|
default_value: "false"
|
|
description: Don't truncate output
|
|
- option: quiet
|
|
shorthand: q
|
|
default_value: "false"
|
|
description: Only show numeric IDs
|