github.com/tompao/docker@v1.9.1/docs/reference/commandline/images.md (about) 1 <!--[metadata]> 2 +++ 3 title = "images" 4 description = "The images command description and usage" 5 keywords = ["list, docker, images"] 6 [menu.main] 7 parent = "smn_cli" 8 +++ 9 <![end-metadata]--> 10 11 # images 12 13 Usage: docker images [OPTIONS] [REPOSITORY[:TAG]] 14 15 List images 16 17 -a, --all=false Show all images (default hides intermediate images) 18 --digests=false Show digests 19 -f, --filter=[] Filter output based on conditions provided 20 --help=false Print usage 21 --no-trunc=false Don't truncate output 22 -q, --quiet=false Only show numeric IDs 23 24 The default `docker images` will show all top level 25 images, their repository and tags, and their virtual size. 26 27 Docker images have intermediate layers that increase reusability, 28 decrease disk usage, and speed up `docker build` by 29 allowing each step to be cached. These intermediate layers are not shown 30 by default. 31 32 The `VIRTUAL SIZE` is the cumulative space taken up by the image and all 33 its parent images. This is also the disk space used by the contents of the 34 Tar file created when you `docker save` an image. 35 36 An image will be listed more than once if it has multiple repository names 37 or tags. This single image (identifiable by its matching `IMAGE ID`) 38 uses up the `VIRTUAL SIZE` listed only once. 39 40 ### Listing the most recently created images 41 42 $ docker images 43 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 44 <none> <none> 77af4d6b9913 19 hours ago 1.089 GB 45 committ latest b6fa739cedf5 19 hours ago 1.089 GB 46 <none> <none> 78a85c484f71 19 hours ago 1.089 GB 47 docker latest 30557a29d5ab 20 hours ago 1.089 GB 48 <none> <none> 5ed6274db6ce 24 hours ago 1.089 GB 49 postgres 9 746b819f315e 4 days ago 213.4 MB 50 postgres 9.3 746b819f315e 4 days ago 213.4 MB 51 postgres 9.3.5 746b819f315e 4 days ago 213.4 MB 52 postgres latest 746b819f315e 4 days ago 213.4 MB 53 54 ### Listing images by name and tag 55 56 The `docker images` command takes an optional `[REPOSITORY[:TAG]]` argument 57 that restricts the list to images that match the argument. If you specify 58 `REPOSITORY`but no `TAG`, the `docker images` command lists all images in the 59 given repository. 60 61 For example, to list all images in the "java" repository, run this command : 62 63 $ docker images java 64 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 65 java 8 308e519aac60 6 days ago 824.5 MB 66 java 7 493d82594c15 3 months ago 656.3 MB 67 java latest 2711b1d6f3aa 5 months ago 603.9 MB 68 69 The `[REPOSITORY[:TAG]]` value must be an "exact match". This means that, for example, 70 `docker images jav` does not match the image `java`. 71 72 If both `REPOSITORY` and `TAG` are provided, only images matching that 73 repository and tag are listed. To find all local images in the "java" 74 repository with tag "8" you can use: 75 76 $ docker images java:8 77 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 78 java 8 308e519aac60 6 days ago 824.5 MB 79 80 If nothing matches `REPOSITORY[:TAG]`, the list is empty. 81 82 $ docker images java:0 83 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 84 85 ## Listing the full length image IDs 86 87 $ docker images --no-trunc 88 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 89 <none> <none> 77af4d6b9913e693e8d0b4b294fa62ade6054e6b2f1ffb617ac955dd63fb0182 19 hours ago 1.089 GB 90 committest latest b6fa739cedf5ea12a620a439402b6004d057da800f91c7524b5086a5e4749c9f 19 hours ago 1.089 GB 91 <none> <none> 78a85c484f71509adeaace20e72e941f6bdd2b25b4c75da8693efd9f61a37921 19 hours ago 1.089 GB 92 docker latest 30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4 20 hours ago 1.089 GB 93 <none> <none> 0124422dd9f9cf7ef15c0617cda3931ee68346455441d66ab8bdc5b05e9fdce5 20 hours ago 1.089 GB 94 <none> <none> 18ad6fad340262ac2a636efd98a6d1f0ea775ae3d45240d3418466495a19a81b 22 hours ago 1.082 GB 95 <none> <none> f9f1e26352f0a3ba6a0ff68167559f64f3e21ff7ada60366e2d44a04befd1d3a 23 hours ago 1.089 GB 96 tryout latest 2629d1fa0b81b222fca63371ca16cbf6a0772d07759ff80e8d1369b926940074 23 hours ago 131.5 MB 97 <none> <none> 5ed6274db6ceb2397844896966ea239290555e74ef307030ebb01ff91b1914df 24 hours ago 1.089 GB 98 99 ## Listing image digests 100 101 Images that use the v2 or later format have a content-addressable identifier 102 called a `digest`. As long as the input used to generate the image is 103 unchanged, the digest value is predictable. To list image digest values, use 104 the `--digests` flag: 105 106 $ docker images --digests 107 REPOSITORY TAG DIGEST IMAGE ID CREATED VIRTUAL SIZE 108 localhost:5000/test/busybox <none> sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf 4986bf8c1536 9 weeks ago 2.43 MB 109 110 When pushing or pulling to a 2.0 registry, the `push` or `pull` command 111 output includes the image digest. You can `pull` using a digest value. You can 112 also reference by digest in `create`, `run`, and `rmi` commands, as well as the 113 `FROM` image reference in a Dockerfile. 114 115 ## Filtering 116 117 The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more 118 than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) 119 120 The currently supported filters are: 121 122 * dangling (boolean - true or false) 123 * label (`label=<key>` or `label=<key>=<value>`) 124 125 ##### Untagged images (dangling) 126 127 $ docker images --filter "dangling=true" 128 129 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 130 <none> <none> 8abc22fbb042 4 weeks ago 0 B 131 <none> <none> 48e5f45168b9 4 weeks ago 2.489 MB 132 <none> <none> bf747efa0e2f 4 weeks ago 0 B 133 <none> <none> 980fe10e5736 12 weeks ago 101.4 MB 134 <none> <none> dea752e4e117 12 weeks ago 101.4 MB 135 <none> <none> 511136ea3c5a 8 months ago 0 B 136 137 This will display untagged images, that are the leaves of the images tree (not 138 intermediary layers). These images occur when a new build of an image takes the 139 `repo:tag` away from the image ID, leaving it untagged. A warning will be issued 140 if trying to remove an image when a container is presently using it. 141 By having this flag it allows for batch cleanup. 142 143 Ready for use by `docker rmi ...`, like: 144 145 $ docker rmi $(docker images -f "dangling=true" -q) 146 147 8abc22fbb042 148 48e5f45168b9 149 bf747efa0e2f 150 980fe10e5736 151 dea752e4e117 152 511136ea3c5a 153 154 NOTE: Docker will warn you if any containers exist that are using these untagged images. 155 156 157 ##### Labeled images 158 159 The `label` filter matches images based on the presence of a `label` alone or a `label` and a 160 value. 161 162 The following filter matches images with the `com.example.version` label regardless of its value. 163 164 $ docker images --filter "label=com.example.version" 165 166 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 167 match-me-1 latest eeae25ada2aa About a minute ago 188.3 MB 168 match-me-2 latest eeae25ada2aa About a minute ago 188.3 MB 169 170 The following filter matches images with the `com.example.version` label with the `1.0` value. 171 172 $ docker images --filter "label=com.example.version=1.0" 173 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE 174 match-me latest eeae25ada2aa About a minute ago 188.3 MB 175 176 In this example, with the `0.1` value, it returns an empty set because no matches were found. 177 178 $ docker images --filter "label=com.example.version=0.1" 179 REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE