github.com/kobeld/docker@v1.12.0-rc1/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            Show all images (default hides intermediate images)
    18        --digests            Show digests
    19        -f, --filter=[]      Filter output based on these conditions:
    20                             - dangling=(true|false)
    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        --help               Print usage
    25        --no-trunc           Don't truncate output
    26        -q, --quiet          Only show numeric IDs
    27  
    28  The default `docker images` will show all top level
    29  images, their repository and tags, and their size.
    30  
    31  Docker images have intermediate layers that increase reusability,
    32  decrease disk usage, and speed up `docker build` by
    33  allowing each step to be cached. These intermediate layers are not shown
    34  by default.
    35  
    36  The `SIZE` is the cumulative space taken up by the image and all
    37  its parent images. This is also the disk space used by the contents of the
    38  Tar file created when you `docker save` an image.
    39  
    40  An image will be listed more than once if it has multiple repository names
    41  or tags. This single image (identifiable by its matching `IMAGE ID`)
    42  uses up the `SIZE` listed only once.
    43  
    44  ### Listing the most recently created images
    45  
    46      $ docker images
    47      REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    48      <none>                    <none>              77af4d6b9913        19 hours ago        1.089 GB
    49      committ                   latest              b6fa739cedf5        19 hours ago        1.089 GB
    50      <none>                    <none>              78a85c484f71        19 hours ago        1.089 GB
    51      docker                    latest              30557a29d5ab        20 hours ago        1.089 GB
    52      <none>                    <none>              5ed6274db6ce        24 hours ago        1.089 GB
    53      postgres                  9                   746b819f315e        4 days ago          213.4 MB
    54      postgres                  9.3                 746b819f315e        4 days ago          213.4 MB
    55      postgres                  9.3.5               746b819f315e        4 days ago          213.4 MB
    56      postgres                  latest              746b819f315e        4 days ago          213.4 MB
    57  
    58  ### Listing images by name and tag
    59  
    60  The `docker images` command takes an optional `[REPOSITORY[:TAG]]` argument
    61  that restricts the list to images that match the argument. If you specify
    62  `REPOSITORY`but no `TAG`, the `docker images` command lists all images in the
    63  given repository.
    64  
    65  For example, to list all images in the "java" repository, run this command :
    66  
    67      $ docker images java
    68      REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    69      java                8                   308e519aac60        6 days ago          824.5 MB
    70      java                7                   493d82594c15        3 months ago        656.3 MB
    71      java                latest              2711b1d6f3aa        5 months ago        603.9 MB
    72  
    73  The `[REPOSITORY[:TAG]]` value must be an "exact match". This means that, for example,
    74  `docker images jav` does not match the image `java`.
    75  
    76  If both `REPOSITORY` and `TAG` are provided, only images matching that
    77  repository and tag are listed.  To find all local images in the "java"
    78  repository with tag "8" you can use:
    79  
    80      $ docker images java:8
    81      REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    82      java                8                   308e519aac60        6 days ago          824.5 MB
    83  
    84  If nothing matches `REPOSITORY[:TAG]`, the list is empty.
    85  
    86      $ docker images java:0
    87      REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    88  
    89  ## Listing the full length image IDs
    90  
    91      $ docker images --no-trunc
    92      REPOSITORY                    TAG                 IMAGE ID                                                                  CREATED             SIZE
    93      <none>                        <none>              sha256:77af4d6b9913e693e8d0b4b294fa62ade6054e6b2f1ffb617ac955dd63fb0182   19 hours ago        1.089 GB
    94      committest                    latest              sha256:b6fa739cedf5ea12a620a439402b6004d057da800f91c7524b5086a5e4749c9f   19 hours ago        1.089 GB
    95      <none>                        <none>              sha256:78a85c484f71509adeaace20e72e941f6bdd2b25b4c75da8693efd9f61a37921   19 hours ago        1.089 GB
    96      docker                        latest              sha256:30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4   20 hours ago        1.089 GB
    97      <none>                        <none>              sha256:0124422dd9f9cf7ef15c0617cda3931ee68346455441d66ab8bdc5b05e9fdce5   20 hours ago        1.089 GB
    98      <none>                        <none>              sha256:18ad6fad340262ac2a636efd98a6d1f0ea775ae3d45240d3418466495a19a81b   22 hours ago        1.082 GB
    99      <none>                        <none>              sha256:f9f1e26352f0a3ba6a0ff68167559f64f3e21ff7ada60366e2d44a04befd1d3a   23 hours ago        1.089 GB
   100      tryout                        latest              sha256:2629d1fa0b81b222fca63371ca16cbf6a0772d07759ff80e8d1369b926940074   23 hours ago        131.5 MB
   101      <none>                        <none>              sha256:5ed6274db6ceb2397844896966ea239290555e74ef307030ebb01ff91b1914df   24 hours ago        1.089 GB
   102  
   103  ## Listing image digests
   104  
   105  Images that use the v2 or later format have a content-addressable identifier
   106  called a `digest`. As long as the input used to generate the image is
   107  unchanged, the digest value is predictable. To list image digest values, use
   108  the `--digests` flag:
   109  
   110      $ docker images --digests
   111      REPOSITORY                         TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
   112      localhost:5000/test/busybox        <none>              sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf   4986bf8c1536        9 weeks ago         2.43 MB
   113  
   114  When pushing or pulling to a 2.0 registry, the `push` or `pull` command
   115  output includes the image digest. You can `pull` using a digest value. You can
   116  also reference by digest in `create`, `run`, and `rmi` commands, as well as the
   117  `FROM` image reference in a Dockerfile.
   118  
   119  ## Filtering
   120  
   121  The filtering flag (`-f` or `--filter`) format is of "key=value". If there is more
   122  than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`)
   123  
   124  The currently supported filters are:
   125  
   126  * dangling (boolean - true or false)
   127  * label (`label=<key>` or `label=<key>=<value>`)
   128  * before (`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`) - filters images created before given id or references
   129  * since (`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`) - filters images created since given id or references
   130  
   131  ##### Untagged images (dangling)
   132  
   133      $ docker images --filter "dangling=true"
   134  
   135      REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
   136      <none>              <none>              8abc22fbb042        4 weeks ago         0 B
   137      <none>              <none>              48e5f45168b9        4 weeks ago         2.489 MB
   138      <none>              <none>              bf747efa0e2f        4 weeks ago         0 B
   139      <none>              <none>              980fe10e5736        12 weeks ago        101.4 MB
   140      <none>              <none>              dea752e4e117        12 weeks ago        101.4 MB
   141      <none>              <none>              511136ea3c5a        8 months ago        0 B
   142  
   143  This will display untagged images, that are the leaves of the images tree (not
   144  intermediary layers). These images occur when a new build of an image takes the
   145  `repo:tag` away from the image ID, leaving it as `<none>:<none>` or untagged.
   146  A warning will be issued if trying to remove an image when a container is presently
   147  using it. By having this flag it allows for batch cleanup.
   148  
   149  Ready for use by `docker rmi ...`, like:
   150  
   151      $ docker rmi $(docker images -f "dangling=true" -q)
   152  
   153      8abc22fbb042
   154      48e5f45168b9
   155      bf747efa0e2f
   156      980fe10e5736
   157      dea752e4e117
   158      511136ea3c5a
   159  
   160  NOTE: Docker will warn you if any containers exist that are using these untagged images.
   161  
   162  
   163  ##### Labeled images
   164  
   165  The `label` filter matches images based on the presence of a `label` alone or a `label` and a
   166  value.
   167  
   168  The following filter matches images with the `com.example.version` label regardless of its value.
   169  
   170      $ docker images --filter "label=com.example.version"
   171  
   172      REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
   173      match-me-1          latest              eeae25ada2aa        About a minute ago   188.3 MB
   174      match-me-2          latest              dea752e4e117        About a minute ago   188.3 MB
   175  
   176  The following filter matches images with the `com.example.version` label with the `1.0` value.
   177  
   178      $ docker images --filter "label=com.example.version=1.0"
   179      REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
   180      match-me            latest              511136ea3c5a        About a minute ago   188.3 MB
   181  
   182  In this example, with the `0.1` value, it returns an empty set because no matches were found.
   183  
   184      $ docker images --filter "label=com.example.version=0.1"
   185      REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
   186  
   187  #### Before
   188  
   189  The `before` filter shows only images created before the image with
   190  given id or reference. For example, having these images:
   191  
   192      $ docker images
   193      REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
   194      image1              latest              eeae25ada2aa        4 minutes ago        188.3 MB
   195      image2              latest              dea752e4e117        9 minutes ago        188.3 MB
   196      image3              latest              511136ea3c5a        25 minutes ago       188.3 MB
   197  
   198  Filtering with `before` would give:
   199  
   200      $ docker images --filter "before=image1"
   201      REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
   202      image2              latest              dea752e4e117        9 minutes ago        188.3 MB
   203      image3              latest              511136ea3c5a        25 minutes ago       188.3 MB
   204  
   205  #### Since
   206  
   207  The `since` filter shows only images created after the image with
   208  given id or reference. For example, having these images:
   209  
   210      $ docker images
   211      REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
   212      image1              latest              eeae25ada2aa        4 minutes ago        188.3 MB
   213      image2              latest              dea752e4e117        9 minutes ago        188.3 MB
   214      image3              latest              511136ea3c5a        25 minutes ago       188.3 MB
   215  
   216  Filtering with `since` would give:
   217  
   218      $ docker images --filter "since=image3"
   219      REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
   220      image1              latest              eeae25ada2aa        4 minutes ago        188.3 MB
   221      image2              latest              dea752e4e117        9 minutes ago        188.3 MB
   222  
   223  
   224  ## Formatting
   225  
   226  The formatting option (`--format`) will pretty print container output
   227  using a Go template.
   228  
   229  Valid placeholders for the Go template are listed below:
   230  
   231  Placeholder | Description
   232  ---- | ----
   233  `.ID` | Image ID
   234  `.Repository` | Image repository
   235  `.Tag` | Image tag
   236  `.Digest` | Image digest
   237  `.CreatedSince` | Elapsed time since the image was created.
   238  `.CreatedAt` | Time when the image was created.
   239  `.Size` | Image disk size.
   240  
   241  When using the `--format` option, the `image` command will either
   242  output the data exactly as the template declares or, when using the
   243  `table` directive, will include column headers as well.
   244  
   245  The following example uses a template without headers and outputs the
   246  `ID` and `Repository` entries separated by a colon for all images:
   247  
   248      $ docker images --format "{{.ID}}: {{.Repository}}"
   249      77af4d6b9913: <none>
   250      b6fa739cedf5: committ
   251      78a85c484f71: <none>
   252      30557a29d5ab: docker
   253      5ed6274db6ce: <none>
   254      746b819f315e: postgres
   255      746b819f315e: postgres
   256      746b819f315e: postgres
   257      746b819f315e: postgres
   258  
   259  To list all images with their repository and tag in a table format you
   260  can use:
   261  
   262      $ docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}"
   263      IMAGE ID            REPOSITORY                TAG
   264      77af4d6b9913        <none>                    <none>
   265      b6fa739cedf5        committ                   latest
   266      78a85c484f71        <none>                    <none>
   267      30557a29d5ab        docker                    latest
   268      5ed6274db6ce        <none>                    <none>
   269      746b819f315e        postgres                  9
   270      746b819f315e        postgres                  9.3
   271      746b819f315e        postgres                  9.3.5
   272      746b819f315e        postgres                  latest