diff --git a/pkg/drivers/kic/kic.go b/pkg/drivers/kic/kic.go index 257e78cba067..e1bd28359de2 100644 --- a/pkg/drivers/kic/kic.go +++ b/pkg/drivers/kic/kic.go @@ -299,8 +299,7 @@ func (d *Driver) Restart() error { // Start an already created kic container func (d *Driver) Start() error { - cr := command.NewExecRunner() // using exec runner for interacting with docker/podman daemon - if _, err := cr.RunCmd(oci.PrefixCmd(exec.Command(d.NodeConfig.OCIBinary, "start", d.MachineName))); err != nil { + if err := oci.StartContainer(d.NodeConfig.OCIBinary, d.MachineName); err != nil { return errors.Wrap(err, "start") } checkRunning := func() error { diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index 047fe928fb5a..ba43e20c9dc3 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -239,7 +239,8 @@ func createContainer(ociBin string, image string, opts ...createOpt) error { args := []string{"run"} // to run nested container from privileged container in podman https://bugzilla.redhat.com/show_bug.cgi?id=1687713 - if ociBin == Podman { + // only add when running locally (linux), when running remotely it needs to be configured on server in libpod.conf + if ociBin == Podman && runtime.GOOS == "linux" { args = append(args, "--cgroup-manager", "cgroupfs") } @@ -254,6 +255,26 @@ func createContainer(ociBin string, image string, opts ...createOpt) error { return nil } +// StartContainer starts a container with "docker/podman start" +func StartContainer(ociBin string, container string) error { + // construct the actual docker start argv + args := []string{"start"} + + // to run nested container from privileged container in podman https://bugzilla.redhat.com/show_bug.cgi?id=1687713 + // only add when running locally (linux), when running remotely it needs to be configured on server in libpod.conf + if ociBin == Podman && runtime.GOOS == "linux" { + args = append(args, "--cgroup-manager", "cgroupfs") + } + + args = append(args, container) + + if _, err := runCmd(exec.Command(ociBin, args...)); err != nil { + return err + } + + return nil +} + // ContainerID returns id of a container name func ContainerID(ociBin string, nameOrID string) (string, error) { rr, err := runCmd(exec.Command(ociBin, "inspect", "-f", "{{.Id}}", nameOrID))