github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/oci/namespaces.go (about)

     1  package oci // import "github.com/docker/docker/oci"
     2  
     3  import specs "github.com/opencontainers/runtime-spec/specs-go"
     4  
     5  // RemoveNamespace removes the `nsType` namespace from OCI spec `s`
     6  func RemoveNamespace(s *specs.Spec, nsType specs.LinuxNamespaceType) {
     7  	for i, n := range s.Linux.Namespaces {
     8  		if n.Type == nsType {
     9  			s.Linux.Namespaces = append(s.Linux.Namespaces[:i], s.Linux.Namespaces[i+1:]...)
    10  			return
    11  		}
    12  	}
    13  }