github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/cli/man/src/image/ls.md (about) 1 This command lists the images stored in the local Docker repository. 2 3 By default, intermediate images, used during builds, are not listed. Some of the 4 output, e.g., image ID, is truncated, for space reasons. However the truncated 5 image ID, and often the first few characters, are enough to be used in other 6 Docker commands that use the image ID. The output includes repository, tag, image 7 ID, date created and the virtual size. 8 9 The title REPOSITORY for the first title may seem confusing. It is essentially 10 the 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 12 repository for all tagged images of the same name. For example consider an image 13 called ubuntu. It may be tagged with 20.04 or 22.04, etc. to manage different 14 versions. 15 16 ## Filters 17 18 Filters 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 42 To list the images in a local repository (not the registry) run: 43 44 docker image ls 45 46 The list will contain the image repository name, a tag for the image, and an 47 image ID, when it was created and its virtual size. Columns: REPOSITORY, TAG, 48 IMAGE ID, CREATED, and SIZE. 49 50 The `docker image ls` command takes an optional `[REPOSITORY[:TAG]]` argument 51 that 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 53 given repository. 54 55 docker image ls java 56 57 The `[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 60 If both `REPOSITORY` and `TAG` are provided, only images matching that 61 repository and tag are listed. To find all local images in the "java" 62 repository with tag "8" you can use: 63 64 docker image ls java:8 65 66 To get a verbose list of images which contains all the intermediate images 67 used in builds use **-a**: 68 69 docker image ls -a 70 71 Previously, the docker image ls command supported the --tree and --dot arguments, 72 which displayed different visualizations of the image data. Docker core removed 73 this functionality in the 1.7 version. If you liked this functionality, you can 74 still find it in the third-party dockviz tool: https://github.com/justone/dockviz. 75 76 ## Listing images in a desired format 77 78 When using the --format option, the image command will either output the data 79 exactly as the template declares or, when using the `table` directive, will 80 include column headers as well. You can use special characters like `\t` for 81 inserting tab spacing between columns. 82 83 The following example uses a template without headers and outputs the ID and 84 Repository 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 97 To 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 111 Valid template placeholders are listed above. 112 113 ## Listing only the shortened image IDs 114 115 Listing just the shortened image IDs. This can be useful for some automated 116 tools. 117 118 docker image ls -q