Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit bc759ee

Browse files
committed
container: remove the unused ns from ocispec
Only keep the pidns and mntns for those containers in sandbox/pod. Signed-off-by: fupan <[email protected]>
1 parent 9f5d2d4 commit bc759ee

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

daemon/pod/container.go

+12
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,18 @@ func (c *Container) containerConfig(cjson *dockertypes.ContainerJSON) (*vc.Conta
648648
}
649649

650650
ociSpec = c.ociSpec(cjson)
651+
652+
//remove those namespace types from ocispec
653+
for _, ns := range []specs.LinuxNamespaceType{
654+
specs.NetworkNamespace,
655+
specs.UserNamespace,
656+
specs.UTSNamespace,
657+
specs.IPCNamespace,
658+
specs.CgroupNamespace,
659+
} {
660+
oci.RemoveNamespace(ociSpec, ns)
661+
}
662+
651663
ociSpecJson, err := json.Marshal(ociSpec)
652664
if err != nil {
653665
return &vc.ContainerConfig{}, nil

0 commit comments

Comments
 (0)