github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/docs/source/markdown/podman-container-clone.1.md (about) 1 % podman-container-clone(1) 2 3 ## NAME 4 podman\-container\-clone - Creates 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 #### **--cpu-period**=*limit* 15 16 Set the CPU period for the Completely Fair Scheduler (CFS), which is a 17 duration in microseconds. Once the container's CPU quota is used up, it will 18 not be scheduled to run until the current period ends. Defaults to 100000 19 microseconds. 20 21 On some systems, changing the CPU limits may not be allowed for non-root 22 users. For more details, see 23 https://github.com/containers/podman/blob/master/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error 24 25 If none is specified, the original container's cpu period is used 26 27 #### **--cpu-quota**=*limit* 28 29 Limit the CPU Completely Fair Scheduler (CFS) quota. 30 31 Limit the container's CPU usage. By default, containers run with the full 32 CPU resource. The limit is a number in microseconds. If a number is provided, 33 the container will be allowed to use that much CPU time until the CPU period 34 ends (controllable via **--cpu-period**). 35 36 On some systems, changing the CPU limits may not be allowed for non-root 37 users. For more details, see 38 https://github.com/containers/podman/blob/master/troubleshooting.md#26-running-containers-with-cpu-limits-fails-with-a-permissions-error 39 40 If none is specified, the original container's CPU quota are used. 41 42 #### **--cpu-rt-period**=*microseconds* 43 44 Limit the CPU real-time period in microseconds 45 46 Limit the container's Real Time CPU usage. This option tells the kernel to restrict the container's Real Time CPU usage to the period specified. 47 48 This option is not supported on cgroups V2 systems. 49 50 If none is specified, the original container's CPU runtime period is used. 51 52 53 #### **--cpu-rt-runtime**=*microseconds* 54 55 Limit the CPU real-time runtime in microseconds. 56 57 Limit the containers Real Time CPU usage. This option tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex: 58 Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks. 59 60 The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup. 61 62 This option is not supported on cgroups V2 systems. 63 64 #### **--cpu-shares**=*shares* 65 66 CPU shares (relative weight) 67 68 By default, all containers get the same proportion of CPU cycles. This proportion 69 can be modified by changing the container's CPU share weighting relative 70 to the weighting of all other running containers. 71 72 To modify the proportion from the default of 1024, use the **--cpu-shares** 73 option to set the weighting to 2 or higher. 74 75 The proportion will only apply when CPU-intensive processes are running. 76 When tasks in one container are idle, other containers can use the 77 left-over CPU time. The actual amount of CPU time will vary depending on 78 the number of containers running on the system. 79 80 For example, consider three containers, one has a cpu-share of 1024 and 81 two others have a cpu-share setting of 512. When processes in all three 82 containers attempt to use 100% of CPU, the first container would receive 83 50% of the total CPU time. If a fourth container is added with a cpu-share 84 of 1024, the first container only gets 33% of the CPU. The remaining containers 85 receive 16.5%, 16.5% and 33% of the CPU. 86 87 On a multi-core system, the shares of CPU time are distributed over all CPU 88 cores. Even if a container is limited to less than 100% of CPU time, it can 89 use 100% of each individual CPU core. 90 91 For example, consider a system with more than three cores. 92 container **{C0}** is started with **-c=512** running one process, and another container 93 **{C1}** with **-c=1024** running two processes, this can result in the following 94 division of CPU shares: 95 96 PID container CPU CPU share 97 100 {C0} 0 100% of CPU0 98 101 {C1} 1 100% of CPU1 99 102 {C1} 2 100% of CPU2 100 101 If none are specified, the original container's CPU shares are used. 102 103 #### **--cpus** 104 105 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. 106 107 This is shorthand 108 for **--cpu-period** and **--cpu-quota**, so only **--cpus** or either both the **--cpu-period** and **--cpu-quota** options can be set. 109 110 #### **--cpuset-cpus** 111 112 CPUs in which to allow execution (0-3, 0,1). If none are specified, the original container's CPUset is used. 113 114 #### **--cpuset-mems**=*nodes* 115 116 Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. 117 118 If there are four memory nodes on the system (0-3), use `--cpuset-mems=0,1` 119 then processes in the container will only use memory from the first 120 two memory nodes. 121 122 If none are specified, the original container's CPU memory nodes are used. 123 124 #### **--destroy** 125 126 Remove the original container that we are cloning once used to mimic the configuration. 127 128 #### **--force**, **-f** 129 130 Force removal of the original container that we are cloning. Can only be used in conjunction with **--destroy**. 131 132 #### **--memory**, **-m**=*limit* 133 134 Memory limit (format: `<number>[<unit>]`, where unit = b (bytes), k (kibibytes), m (mebibytes), or g (gibibytes)) 135 136 Allows the memory available to a container to be constrained. If the host 137 supports swap memory, then the **-m** memory setting can be larger than physical 138 RAM. If a limit of 0 is specified (not using **-m**), the container's memory is 139 not limited. The actual limit may be rounded up to a multiple of the operating 140 system's page size (the value would be very large, that's millions of trillions). 141 142 If no memory limits are specified, the original container's will be used. 143 144 #### **--memory-reservation**=*limit* 145 146 Memory soft limit (format: `<number>[<unit>]`, where unit = b (bytes), k (kibibytes), m (mebibytes), or g (gibibytes)) 147 148 After setting memory reservation, when the system detects memory contention 149 or low memory, containers are forced to restrict their consumption to their 150 reservation. So you should always set the value below **--memory**, otherwise the 151 hard limit will take precedence. By default, memory reservation will be the same 152 as memory limit from the container being cloned. 153 154 #### **--memory-swap**=*limit* 155 156 A limit value equal to memory plus swap. Must be used with the **-m** 157 (**--memory**) flag. The swap `LIMIT` should always be larger than **-m** 158 (**--memory**) value. By default, the swap `LIMIT` will be set to double 159 the value of --memory if specified. Otherwise, the container being cloned will be used to derive the swap value. 160 161 The format of `LIMIT` is `<number>[<unit>]`. Unit can be `b` (bytes), 162 `k` (kibibytes), `m` (mebibytes), or `g` (gibibytes). If you don't specify a 163 unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. 164 165 #### **--memory-swappiness**=*number* 166 167 Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. 168 169 This flag is not supported on cgroups V2 systems. 170 171 #### **--name** 172 173 Set a custom name for the cloned container. The default if not specified is of the syntax: **<ORIGINAL_NAME>-clone** 174 175 #### **--pod**=*name* 176 177 Clone the container in an existing pod. It is helpful to move a container to an 178 existing pod. The container will join the pod shared namespaces, losing its configuration 179 that conflicts with the shared namespaces. 180 181 #### **--run** 182 183 When set to true, this flag runs the newly created container after the 184 clone process has completed, this specifies a detached running mode. 185 186 ## EXAMPLES 187 ``` 188 # podman container clone d0cf1f782e2ed67e8c0050ff92df865a039186237a4df24d7acba5b1fa8cc6e7 189 6b2c73ff8a1982828c9ae2092954bcd59836a131960f7e05221af9df5939c584 190 ``` 191 192 ``` 193 # podman container clone --name=clone d0cf1f782e2ed67e8c0050ff92df865a039186237a4df24d7acba5b1fa8cc6e7 194 6b2c73ff8a1982828c9ae2092954bcd59836a131960f7e05221af9df5939c584 195 ``` 196 197 ``` 198 # podman container clone --destroy --cpus=5 d0cf1f782e2ed67e8c0050ff92df865a039186237a4df24d7acba5b1fa8cc6e7 199 6b2c73ff8a1982828c9ae2092954bcd59836a131960f7e05221af9df5939c584 200 ``` 201 202 ``` 203 # podman container clone 2d4d4fca7219b4437e0d74fcdc272c4f031426a6eacd207372691207079551de new_name fedora 204 Resolved "fedora" as an alias (/etc/containers/registries.conf.d/shortnames.conf) 205 Trying to pull registry.fedoraproject.org/fedora:latest... 206 Getting image source signatures 207 Copying blob c6183d119aa8 done 208 Copying config e417cd49a8 done 209 Writing manifest to image destination 210 Storing signatures 211 5a9b7851013d326aa4ac4565726765901b3ecc01fcbc0f237bc7fd95588a24f9 212 ``` 213 ## SEE ALSO 214 **[podman-create(1)](podman-create.1.md)**, **[cgroups(7)](https://man7.org/linux/man-pages/man7/cgroups.7.html)** 215 216 ## HISTORY 217 January 2022, Originally written by Charlie Doern <cdoern@redhat.com>