namespaces.go 457 B

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