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