github.com/containers/podman/v5@v5.1.0-rc1/docs/source/markdown/podman-container-clone.1.md.in (about)

     1  % podman-container-clone 1
     2  
     3  ## NAME
     4  podman\-container\-clone - Create a copy of an existing container
     5  
     6  ## SYNOPSIS
     7  **podman container clone** [*options*] *container* *name* *image*
     8  
     9  ## DESCRIPTION
    10  **podman container clone** creates a copy of a container, recreating the original with an identical configuration. This command takes three arguments: the first being the container ID or name to clone, the second argument in this command can change the name of the clone from the default of $ORIGINAL_NAME-clone, and the third is a new image to use in the cloned container.
    11  
    12  ## OPTIONS
    13  
    14  @@option blkio-weight
    15  
    16  @@option blkio-weight-device
    17  
    18  @@option cpu-period
    19  
    20  If none is specified, the original container's cpu period is used
    21  
    22  @@option cpu-quota
    23  
    24  If none is specified, the original container's CPU quota are used.
    25  
    26  @@option cpu-rt-period
    27  
    28  If none is specified, the original container's CPU runtime period is used.
    29  
    30  @@option cpu-rt-runtime
    31  
    32  @@option cpu-shares
    33  
    34  If none are specified, the original container's CPU shares are used.
    35  
    36  #### **--cpus**
    37  
    38  Set a number of CPUs for the container that overrides the original containers CPU limits. If none are specified, the original container's Nano CPUs are used.
    39  
    40  This is shorthand
    41  for **--cpu-period** and **--cpu-quota**, so only **--cpus** or either both the **--cpu-period** and **--cpu-quota** options can be set.
    42  
    43  This option is not supported on cgroups V1 rootless systems.
    44  
    45  @@option cpuset-cpus
    46  
    47  If none are specified, the original container's CPUset is used.
    48  
    49  @@option cpuset-mems
    50  
    51  If none are specified, the original container's CPU memory nodes are used.
    52  
    53  @@option destroy
    54  
    55  @@option device-read-bps
    56  
    57  @@option device-write-bps
    58  
    59  #### **--force**, **-f**
    60  
    61  Force removal of the original container that we are cloning. Can only be used in conjunction with **--destroy**.
    62  
    63  @@option memory
    64  
    65  If no memory limits are specified, the original container's memory limits are used.
    66  
    67  @@option memory-reservation
    68  
    69  If unspecified, memory reservation is the same as memory limit from the
    70  container being cloned.
    71  
    72  @@option memory-swap
    73  
    74  If unspecified, the container being cloned is used to derive
    75  the swap value.
    76  
    77  @@option memory-swappiness
    78  
    79  #### **--name**
    80  
    81  Set a custom name for the cloned container. The default if not specified is of the syntax: **\<ORIGINAL_NAME\>-clone**
    82  
    83  #### **--pod**=*name*
    84  
    85  Clone the container in an existing pod.  It is helpful to move a container to an
    86  existing pod.  The container joins the pod shared namespaces, losing its configuration
    87  that conflicts with the shared namespaces.
    88  
    89  #### **--run**
    90  
    91  When set to true, this flag runs the newly created container after the
    92  clone process has completed, this specifies a detached running mode.
    93  
    94  ## EXAMPLES
    95  
    96  Clone specified container into a new container:
    97  ```
    98  # podman container clone d0cf1f782e2ed67e8c0050ff92df865a039186237a4df24d7acba5b1fa8cc6e7
    99  6b2c73ff8a1982828c9ae2092954bcd59836a131960f7e05221af9df5939c584
   100  ```
   101  
   102  Clone specified container into a newly named container:
   103  ```
   104  # podman container clone --name=clone d0cf1f782e2ed67e8c0050ff92df865a039186237a4df24d7acba5b1fa8cc6e7
   105  6b2c73ff8a1982828c9ae2092954bcd59836a131960f7e05221af9df5939c584
   106  ```
   107  
   108  Replace specified container with selected resource constraints into a new container, removing original container:
   109  ```
   110  # podman container clone --destroy --cpus=5 d0cf1f782e2ed67e8c0050ff92df865a039186237a4df24d7acba5b1fa8cc6e7
   111  6b2c73ff8a1982828c9ae2092954bcd59836a131960f7e05221af9df5939c584
   112  ```
   113  
   114  Clone specified container giving a new name and then replacing the image of the original container with the specified image name:
   115  ```
   116  # podman container clone 2d4d4fca7219b4437e0d74fcdc272c4f031426a6eacd207372691207079551de new_name fedora
   117  Resolved "fedora" as an alias (/etc/containers/registries.conf.d/shortnames.conf)
   118  Trying to pull registry.fedoraproject.org/fedora:latest...
   119  Getting image source signatures
   120  Copying blob c6183d119aa8 done
   121  Copying config e417cd49a8 done
   122  Writing manifest to image destination
   123  Storing signatures
   124  5a9b7851013d326aa4ac4565726765901b3ecc01fcbc0f237bc7fd95588a24f9
   125  ```
   126  
   127  ## SEE ALSO
   128  **[podman-create(1)](podman-create.1.md)**, **[cgroups(7)](https://man7.org/linux/man-pages/man7/cgroups.7.html)**
   129  
   130  ## HISTORY
   131  January 2022, Originally written by Charlie Doern <cdoern@redhat.com>