github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/oci/namespaces.go (about)

     1  package oci // import "github.com/demonoid81/moby/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  }