summaryrefslogtreecommitdiff
path: root/libpod/runtime_pod_infra_linux.go
diff options
context:
space:
mode:
authorcdoern <cdoern@redhat.com>2021-07-07 17:00:30 -0400
committercdoern <cdoern@redhat.com>2021-07-15 10:34:09 -0400
commitf7321681d04d65da3b307d1e5e4ba12c42b5c456 (patch)
tree8479b72f55d61a400a1eef4c3540fdb32d4e64d5 /libpod/runtime_pod_infra_linux.go
parent1a9cb93f16cf19e14581319e2fd1b60e791f74dd (diff)
downloadpodman-f7321681d04d65da3b307d1e5e4ba12c42b5c456.tar.gz
podman-f7321681d04d65da3b307d1e5e4ba12c42b5c456.tar.bz2
podman-f7321681d04d65da3b307d1e5e4ba12c42b5c456.zip
podman pod create --pid flag
added support for --pid flag. User can specify ns:file, pod, private, or host. container returns an error since you cannot point the ns of the pods infra container to a container outside of the pod. Signed-off-by: cdoern <cdoern@redhat.com>
Diffstat (limited to 'libpod/runtime_pod_infra_linux.go')
-rw-r--r--libpod/runtime_pod_infra_linux.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index 6b002f65a..8342352ec 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -145,6 +145,18 @@ func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, rawIm
if len(p.config.InfraContainer.ExitCommand) > 0 {
options = append(options, WithExitCommand(p.config.InfraContainer.ExitCommand))
}
+
+ if p.config.UsePodPID && p.config.InfraContainer.PidNS.NSMode != "host" {
+ g.AddOrReplaceLinuxNamespace(string(spec.LinuxNamespaceType("pid")), p.config.InfraContainer.PidNS.Value)
+ } else if p.config.InfraContainer.PidNS.NSMode == "host" {
+ newNS := []spec.LinuxNamespace{}
+ for _, entry := range g.Config.Linux.Namespaces {
+ if entry.Type != spec.LinuxNamespaceType("pid") {
+ newNS = append(newNS, entry)
+ }
+ }
+ g.Config.Linux.Namespaces = newNS
+ }
}
g.SetRootReadonly(true)
g.SetProcessArgs(infraCtrCommand)