github.com/containers/podman/v5@v5.1.0-rc1/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 aren't paused while the image is committed. If this is not desired, the **--pause** OPTION can be set to *true*. When the commit is complete, Podman prints out the ID of the new image.
    13  
    14  If `image` does not begin with a registry name component, `localhost` is added to the name.
    15  If `image` is not provided, the values for the `REPOSITORY` and `TAG` values of the created image is 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  #### **--config**=*ConfigBlobFile*
    40  
    41  Merge the container configuration from the specified file into the configuration for the image
    42  as it is being committed. The file contents should be a JSON-encoded version of
    43  a Schema2Config structure, which is defined at
    44  https://github.com/containers/image/blob/v5.29.0/manifest/docker_schema2.go#L67.
    45  
    46  #### **--format**, **-f**=**oci** | *docker*
    47  
    48  Set the format of the image manifest and metadata.  The currently supported formats are **oci** and *docker*.\
    49  The default is **oci**.
    50  
    51  #### **--iidfile**=*ImageIDfile*
    52  
    53  Write the image ID to the file.
    54  
    55  #### **--include-volumes**
    56  
    57  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.\
    58  The default is **false**.
    59  
    60  #### **--message**, **-m**=*message*
    61  
    62  Set commit message for committed image.\
    63  *IMPORTANT: The message field is not supported in `oci` format.*
    64  
    65  #### **--pause**, **-p**
    66  
    67  Pause the container when creating an image.\
    68  The default is **false**.
    69  
    70  #### **--quiet**, **-q**
    71  
    72  Suppresses output.\
    73  The default is **false**.
    74  
    75  #### **--squash**, **-s**
    76  
    77  Squash newly built layers into a single new layer.\
    78  The default is **false**.
    79  
    80  ## EXAMPLES
    81  Create image from container with entrypoint and label:
    82  ```
    83  $ podman commit --change CMD=/bin/bash --change ENTRYPOINT=/bin/sh --change "LABEL blue=image" reverent_golick image-committed
    84  Getting image source signatures
    85  Copying blob sha256:b41deda5a2feb1f03a5c1bb38c598cbc12c9ccd675f438edc6acd815f7585b86
    86   25.80 MB / 25.80 MB [======================================================] 0s
    87  Copying config sha256:c16a6d30f3782288ec4e7521c754acc29d37155629cb39149756f486dae2d4cd
    88   448 B / 448 B [============================================================] 0s
    89  Writing manifest to image destination
    90  Storing signatures
    91  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
    92  ```
    93  
    94  Create image from container with commit message:
    95  ```
    96  $ podman commit -q --message "committing container to image"
    97  reverent_golick image-committed
    98  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
    99  ```
   100  
   101  Create image from container with author:
   102  ```
   103  $ podman commit -q --author "firstName lastName" reverent_golick image-committed
   104  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
   105  ```
   106  
   107  Pause running container while creating image:
   108  ```
   109  $ podman commit -q --pause=true containerID image-committed
   110  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
   111  ```
   112  
   113  Create image from container with default image tag:
   114  ```
   115  $ podman commit containerID
   116  e3ce4d93051ceea088d1c242624d659be32cf1667ef62f1d16d6b60193e2c7a8
   117  ```
   118  
   119  Create image from container with default required capabilities:
   120  ```
   121  $ podman commit -q --change LABEL=io.containers.capabilities=setuid,setgid epic_nobel privimage
   122  400d31a3f36dca751435e80a0e16da4859beb51ff84670ce6bdc5edb30b94066
   123  ```
   124  
   125  ## SEE ALSO
   126  **[podman(1)](podman.1.md)**, **[podman-run(1)](podman-run.1.md)**, **[podman-create(1)](podman-create.1.md)**
   127  
   128  ## HISTORY
   129  December 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>