diff options
author | cdoern <cbdoer23@g.holycross.edu> | 2022-05-13 10:52:57 -0400 |
---|---|---|
committer | cdoern <cdoern@redhat.com> | 2022-06-10 14:23:19 -0400 |
commit | 958759a71955860b01b17bd3bebf38f9dae1018e (patch) | |
tree | 34872e81fb126f854c7612ca39f11932ccd3f8bb /pkg/domain/infra/abi/containers.go | |
parent | 6a2c0e96011d36e5b459a010d472facd26c67389 (diff) | |
download | podman-958759a71955860b01b17bd3bebf38f9dae1018e.tar.gz podman-958759a71955860b01b17bd3bebf38f9dae1018e.tar.bz2 podman-958759a71955860b01b17bd3bebf38f9dae1018e.zip |
podman pod clone
implement podman pod clone, a command to create an exact copy of a pod while changing
certain config elements
current supported flags are:
--name change the pod name
--destroy remove the original pod
--start run the new pod on creation
and all infra-container related flags from podman pod create (namespaces etc)
resolves #12843
Signed-off-by: cdoern <cdoern@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index 8bd84a310..c7cd0cb56 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -1593,6 +1593,11 @@ func (ic *ContainerEngine) ContainerClone(ctx context.Context, ctrCloneOpts enti return nil, err } + conf := c.Config() + if conf.Spec != nil && conf.Spec.Process != nil && conf.Spec.Process.Terminal { // if we do not pass term, running ctrs exit + spec.Terminal = true + } + // Print warnings if len(out) > 0 { for _, w := range out { @@ -1612,8 +1617,8 @@ func (ic *ContainerEngine) ContainerClone(ctx context.Context, ctrCloneOpts enti switch { case strings.Contains(n, "-clone"): ind := strings.Index(n, "-clone") + 6 - num, _ := strconv.Atoi(n[ind:]) - if num == 0 { // clone1 is hard to get with this logic, just check for it here. + num, err := strconv.Atoi(n[ind:]) + if num == 0 && err != nil { // clone1 is hard to get with this logic, just check for it here. _, err = ic.Libpod.LookupContainer(n + "1") if err != nil { spec.Name = n + "1" |