mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
Implement Podman Container Clone
podman container clone takes the id of an existing continer and creates a specgen from the given container's config recreating all proper namespaces and overriding spec options like resource limits and the container name if given in the cli options this command utilizes the common function DefineCreateFlags meaning that we can funnel as many create options as we want into clone over time allowing the user to clone with as much or as little of the original config as they want. container clone takes a second argument which is a new name and a third argument which is an image name to use instead of the original container's the current supported flags are: --destroy (remove the original container) --name (new ctr name) --cpus (sets cpu period and quota) --cpuset-cpus --cpu-period --cpu-rt-period --cpu-rt-runtime --cpu-shares --cpuset-mems --memory --run resolves #10875 Signed-off-by: cdoern <cdoern@redhat.com> Signed-off-by: cdoern <cbdoer23@g.holycross.edu> Signed-off-by: cdoern <cdoern@redhat.com>
This commit is contained in:
@ -26,6 +26,8 @@ func validate(c *entities.ContainerCreateOptions) error {
|
||||
if _, ok := imageVolType[c.ImageVolume]; !ok {
|
||||
if c.IsInfra {
|
||||
c.ImageVolume = "bind"
|
||||
} else if c.IsClone { // the image volume type will be deduced later from the container we are cloning
|
||||
return nil
|
||||
} else {
|
||||
return errors.Errorf("invalid image-volume type %q. Pick one of bind, tmpfs, or ignore", c.ImageVolume)
|
||||
}
|
||||
|
Reference in New Issue
Block a user