Merge pull request #7000 from akhramov/freebsd_linux_containers
This commit is contained in:
commit
2b4b0cf28f
@ -377,6 +377,7 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
|
|||||||
return fmt.Errorf("unknown image config media type %s", ic.MediaType)
|
return fmt.Errorf("unknown image config media type %s", ic.MediaType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appendOSMounts(s, ociimage.OS)
|
||||||
setProcess(s)
|
setProcess(s)
|
||||||
if s.Linux != nil {
|
if s.Linux != nil {
|
||||||
defaults := config.Env
|
defaults := config.Env
|
||||||
|
21
oci/spec_opts_darwin.go
Normal file
21
oci/spec_opts_darwin.go
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package oci
|
||||||
|
|
||||||
|
func appendOSMounts(s *Spec, os string) error {
|
||||||
|
return nil
|
||||||
|
}
|
50
oci/spec_opts_freebsd.go
Normal file
50
oci/spec_opts_freebsd.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package oci
|
||||||
|
|
||||||
|
import (
|
||||||
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
)
|
||||||
|
|
||||||
|
// appendOSMounts modifies the mount spec to mount emulated Linux filesystems on FreeBSD,
|
||||||
|
// as per: https://wiki.freebsd.org/LinuxJails
|
||||||
|
func appendOSMounts(s *Spec, os string) error {
|
||||||
|
// No-op for FreeBSD containers
|
||||||
|
if os != "linux" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
/* The nosuid noexec options are for consistency with Linux mounts: on FreeBSD it is
|
||||||
|
by default impossible to execute anything from these filesystems.
|
||||||
|
*/
|
||||||
|
var mounts = []specs.Mount{
|
||||||
|
{
|
||||||
|
Destination: "/proc",
|
||||||
|
Type: "linprocfs",
|
||||||
|
Source: "linprocfs",
|
||||||
|
Options: []string{"nosuid", "noexec"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Destination: "/sys",
|
||||||
|
Type: "linsysfs",
|
||||||
|
Source: "linsysfs",
|
||||||
|
Options: []string{"nosuid", "noexec", "nodev"},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
s.Mounts = append(mounts, s.Mounts...)
|
||||||
|
return nil
|
||||||
|
}
|
@ -203,3 +203,7 @@ func WithCDI(annotations map[string]string, cdiSpecDirs []string) SpecOpts {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendOSMounts(s *Spec, os string) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
@ -115,3 +115,7 @@ func escapeAndCombineArgs(args []string) string {
|
|||||||
}
|
}
|
||||||
return strings.Join(escaped, " ")
|
return strings.Join(escaped, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func appendOSMounts(s *Spec, os string) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
42
platforms/defaults_freebsd.go
Normal file
42
platforms/defaults_freebsd.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package platforms
|
||||||
|
|
||||||
|
import (
|
||||||
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultSpec returns the current platform's default platform specification.
|
||||||
|
func DefaultSpec() specs.Platform {
|
||||||
|
return specs.Platform{
|
||||||
|
OS: runtime.GOOS,
|
||||||
|
Architecture: runtime.GOARCH,
|
||||||
|
// The Variant field will be empty if arch != ARM.
|
||||||
|
Variant: cpuVariant(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default returns the default matcher for the platform.
|
||||||
|
func Default() MatchComparer {
|
||||||
|
return Ordered(DefaultSpec(), specs.Platform{
|
||||||
|
OS: "linux",
|
||||||
|
Architecture: runtime.GOARCH,
|
||||||
|
// The Variant field will be empty if arch != ARM.
|
||||||
|
Variant: cpuVariant(),
|
||||||
|
})
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !windows && !darwin
|
//go:build !windows && !darwin && !freebsd
|
||||||
// +build !windows,!darwin
|
// +build !windows,!darwin,!freebsd
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
|
Loading…
Reference in New Issue
Block a user