github.com/docker/docker-ce@v17.12.1-ce-rc2+incompatible/components/cli/docs/reference/commandline/history.md (about)

     1  ---
     2  title: "history"
     3  description: "The history command description and usage"
     4  keywords: "docker, image, history"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/cli GitHub
     8       repository at https://github.com/docker/cli/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # history
    17  
    18  ```markdown
    19  Usage:  docker history [OPTIONS] IMAGE
    20  
    21  Show the history of an image
    22  
    23  Options:
    24        --format string   Pretty-print images using a Go template
    25        --help            Print usage
    26    -H, --human           Print sizes and dates in human readable format (default true)
    27        --no-trunc        Don't truncate output
    28    -q, --quiet           Only show numeric IDs
    29  ```
    30  
    31  
    32  ## Examples
    33  
    34  To see how the `docker:latest` image was built:
    35  
    36  ```bash
    37  $ docker history docker
    38  
    39  IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
    40  3e23a5875458        8 days ago          /bin/sh -c #(nop) ENV LC_ALL=C.UTF-8            0 B
    41  8578938dd170        8 days ago          /bin/sh -c dpkg-reconfigure locales &&    loc   1.245 MB
    42  be51b77efb42        8 days ago          /bin/sh -c apt-get update && apt-get install    338.3 MB
    43  4b137612be55        6 weeks ago         /bin/sh -c #(nop) ADD jessie.tar.xz in /        121 MB
    44  750d58736b4b        6 weeks ago         /bin/sh -c #(nop) MAINTAINER Tianon Gravi <ad   0 B
    45  511136ea3c5a        9 months ago                                                        0 B                 Imported from -
    46  ```
    47  
    48  To see how the `docker:apache` image was added to a container's base image:
    49  
    50  ```bash
    51  $ docker history docker:scm
    52  IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
    53  2ac9d1098bf1        3 months ago        /bin/bash                                       241.4 MB            Added Apache to Fedora base image
    54  88b42ffd1f7c        5 months ago        /bin/sh -c #(nop) ADD file:1fd8d7f9f6557cafc7   373.7 MB
    55  c69cab00d6ef        5 months ago        /bin/sh -c #(nop) MAINTAINER Lokesh Mandvekar   0 B
    56  511136ea3c5a        19 months ago                                                       0 B                 Imported from -
    57  ```
    58  
    59  ### Format the output
    60  
    61  The formatting option (`--format`) will pretty-prints history output
    62  using a Go template.
    63  
    64  Valid placeholders for the Go template are listed below:
    65  
    66  | Placeholder     | Description |
    67  | --------------- | ----------- |
    68  | `.ID`           | Image ID    |
    69  | `.CreatedSince` | Elapsed time since the image was created if `--human=true`, otherwise timestamp of when image was created |
    70  | `.CreatedAt`    | Timestamp of when image was created |
    71  | `.CreatedBy`    | Command that was used to create the image |
    72  | `.Size`         | Image disk size |
    73  | `.Comment`      | Comment for image |
    74  
    75  When using the `--format` option, the `history` command will either
    76  output the data exactly as the template declares or, when using the
    77  `table` directive, will include column headers as well.
    78  
    79  The following example uses a template without headers and outputs the
    80  `ID` and `CreatedSince` entries separated by a colon for all images:
    81  
    82  ```bash
    83  $ docker images --format "{{.ID}}: {{.Created}} ago"
    84  
    85  cc1b61406712: 2 weeks ago
    86  <missing>: 2 weeks ago
    87  <missing>: 2 weeks ago
    88  <missing>: 2 weeks ago
    89  <missing>: 2 weeks ago
    90  <missing>: 3 weeks ago
    91  <missing>: 3 weeks ago
    92  <missing>: 3 weeks ago
    93  ```