1This command lists the images stored in the local Docker repository.
2
3By default, intermediate images, used during builds, are not listed. Some of the
4output, e.g., image ID, is truncated, for space reasons. However the truncated
5image ID, and often the first few characters, are enough to be used in other
6Docker commands that use the image ID. The output includes repository, tag, image
7ID, date created and the virtual size.
8
9The title REPOSITORY for the first title may seem confusing. It is essentially
10the image name. However, because you can tag a specific image, and multiple tags
11(image instances) can be associated with a single name, the name is really a
12repository for all tagged images of the same name. For example consider an image
13called fedora. It may be tagged with 18, 19, or 20, etc. to manage different
14versions.
15
16## Filters
17
18Filters the output based on these conditions:
19
20   - dangling=(true|false) - find unused images
21   - label=<key> or label=<key>=<value>
22   - before=(<image-name>[:tag]|<image-id>|<image@digest>)
23   - since=(<image-name>[:tag]|<image-id>|<image@digest>)
24   - reference=(pattern of an image reference)
25
26## Format
27
28   Pretty-print images using a Go template.
29   Valid placeholders:
30      .ID - Image ID
31      .Repository - Image repository
32      .Tag - Image tag
33      .Digest - Image digest
34      .CreatedSince - Elapsed time since the image was created
35      .CreatedAt - Time when the image was created
36      .Size - Image disk size
37
38# EXAMPLES
39
40## Listing the images
41
42To list the images in a local repository (not the registry) run:
43
44    docker image ls
45
46The list will contain the image repository name, a tag for the image, and an
47image ID, when it was created and its virtual size. Columns: REPOSITORY, TAG,
48IMAGE ID, CREATED, and SIZE.
49
50The `docker image ls` command takes an optional `[REPOSITORY[:TAG]]` argument
51that restricts the list to images that match the argument. If you specify
52`REPOSITORY` but no `TAG`, the `docker image ls` command lists all images in the
53given repository.
54
55    docker image ls java
56
57The `[REPOSITORY[:TAG]]` value must be an "exact match". This means that, for example,
58`docker image ls jav` does not match the image `java`.
59
60If both `REPOSITORY` and `TAG` are provided, only images matching that
61repository and tag are listed.  To find all local images in the "java"
62repository with tag "8" you can use:
63
64    docker image ls java:8
65
66To get a verbose list of images which contains all the intermediate images
67used in builds use **-a**:
68
69    docker image ls -a
70
71Previously, the docker image ls command supported the --tree and --dot arguments,
72which displayed different visualizations of the image data. Docker core removed
73this functionality in the 1.7 version. If you liked this functionality, you can
74still find it in the third-party dockviz tool: https://github.com/justone/dockviz.
75
76## Listing images in a desired format
77
78When using the --format option, the image command will either output the data
79exactly as the template declares or, when using the `table` directive, will
80include column headers as well. You can use special characters like `\t` for
81inserting tab spacing between columns.
82
83The following example uses a template without headers and outputs the ID and
84Repository entries separated by a colon for all images:
85
86    docker images --format "{{.ID}}: {{.Repository}}"
87    77af4d6b9913: <none>
88    b6fa739cedf5: committ
89    78a85c484bad: ipbabble
90    30557a29d5ab: docker
91    5ed6274db6ce: <none>
92    746b819f315e: postgres
93    746b819f315e: postgres
94    746b819f315e: postgres
95    746b819f315e: postgres
96
97To list all images with their repository and tag in a table format you can use:
98
99    docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
100    IMAGE ID            REPOSITORY                TAG
101    77af4d6b9913        <none>                    <none>
102    b6fa739cedf5        committ                   latest
103    78a85c484bad        ipbabble                  <none>
104    30557a29d5ab        docker                    latest
105    5ed6274db6ce        <none>                    <none>
106    746b819f315e        postgres                  9
107    746b819f315e        postgres                  9.3
108    746b819f315e        postgres                  9.3.5
109    746b819f315e        postgres                  latest
110
111Valid template placeholders are listed above.
112
113## Listing only the shortened image IDs
114
115Listing just the shortened image IDs. This can be useful for some automated
116tools.
117
118    docker image ls -q
119