github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/docs/source/markdown/podman-commit.1.md (about)

     1  % podman-commit(1)
     2  
     3  ## NAME
     4  podman\-commit - Create new image based on the changed container
     5  
     6  ## SYNOPSIS
     7  **podman commit** [*options*] *container* [*image*]
     8  
     9  **podman container commit** [*options*] *container* [*image*]
    10  
    11  ## DESCRIPTION
    12  **podman commit** creates an image based on a changed *container*. The author of the image can be set using the **--author** OPTION. Various image instructions can be configured with the **--change** OPTION and a commit message can be set using the **--message** OPTION. The *container* and its processes are paused while the image is committed. This minimizes the likelihood of data corruption when creating the new image. If this is not desired, the **--pause** OPTION can be set to *false*. When the commit is complete, Podman will print out the ID of the new image.
    13  
    14  If `image` does not begin with a registry name component, `localhost` will be added to the name.
    15  If `image` is not provided, the values for the `REPOSITORY` and `TAG` values of the created image will each be set to `<none>`.
    16  
    17  ## OPTIONS
    18  #### **--author**, **-a**=*author*
    19  
    20  Set the author for the committed image.
    21  
    22  #### **--change**, **-c**=*instruction*
    23  
    24  Apply the following possible instructions to the created image:
    25  
    26  - *CMD*
    27  - *ENTRYPOINT*
    28  - *ENV*
    29  - *EXPOSE*
    30  - *LABEL*
    31  - *ONBUILD*
    32  - *STOPSIGNAL*
    33  - *USER*
    34  - *VOLUME*
    35  - *WORKDIR*
    36  
    37  Can be set multiple times.
    38  
    39  #### **--format**, **-f** =**oci** | *docker*
    40  
    41  Set the format of the image manifest and metadata.  The currently supported formats are **oci** and *docker*.\
    42  The default is **oci**.
    43  
    44  #### **--iidfile**=*ImageIDfile*
    45  
    46  Write the image ID to the file.
    47  
    48  #### **--include-volumes**
    49  
    50  Include in the committed image any volumes added to the container by the **--volume** or **--mount** OPTIONS to the **[podman create](podman-create.1.md)** and **[podman run](podman-run.1.md)** commands.\
    51  The default is **false**.
    52  
    53  #### **--message**, **-m**=*message*
    54  
    55  Set commit message for committed image.\
    56  *IMPORTANT: The message field is not supported in `oci` format.*
    57  
    58  #### **--pause**, **-p**
    59  
    60  Pause the container when creating an image.\
    61  The default is **false**.
    62  
    63  #### **--quiet**, **-q**
    64  
    65  Suppresses output.\
    66  The default is **false**.
    67  
    68  #### **--squash**, **-s**
    69  
    70  Squash newly built layers into a single new layer.\
    71  The default is **false**.
    72  
    73  ## EXAMPLES
    74  Create image from container with entrypoint and label
    75  ```
    76  $ podman commit --change CMD=/bin/bash --change ENTRYPOINT=/bin/sh --change "LABEL blue=image" reverent_golick image-committed
    77  Getting image source signatures
    78  Copying blob sha256:b41deda5a2feb1f03a5c1bb38c598cbc12c9ccd675f438edc6acd815f7585b86
    79   25.80 MB / 25.80 MB [======================================================] 0s
    80  Copying config sha256:c16a6d30f3782288ec4e7521c754acc29d37155629cb39149756f486dae2d4cd
    81   448 B / 448 B [============================================================] 0s
    82  Writing manifest to image destination
    83  Storing signatures
    84  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
    85  ```
    86  
    87  Create image from container with commit message
    88  ```
    89  $ podman commit -q --message "committing container to image"
    90  reverent_golick image-committed
    91  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
    92  ```
    93  
    94  Create image from container with author
    95  ```
    96  $ podman commit -q --author "firstName lastName" reverent_golick image-committed
    97  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
    98  ```
    99  
   100  Pause a running container while creating the image
   101  ```
   102  $ podman commit -q --pause=true containerID image-committed
   103  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
   104  ```
   105  
   106  Create an image from a container with a default image tag
   107  ```
   108  $ podman commit containerID
   109  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
   110  ```
   111  
   112  Create an image from container with default required capabilities are SETUID and SETGID
   113  ```
   114  $ podman commit -q --change LABEL=io.containers.capabilities=setuid,setgid epic_nobel privimage
   115  400d31a3f36dca751435e80a0e16da4859beb51ff84670ce6bdc5edb30b94066
   116  ```
   117  
   118  ## SEE ALSO
   119  **[podman(1)](podman.1.md)**, **[podman-run(1)](podman-run.1.md)**, **[podman-create(1)](podman-create.1.md)**
   120  
   121  ## HISTORY
   122  December 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>