Merge pull request #40766 from thaJeztah/lcow_build_tag
LCOW: add "no_lcow" build tag to allow disabling lcow
This commit is contained in:
commit
71626b7bdf
|
@ -1,12 +0,0 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package system // import "github.com/docker/docker/pkg/system"
|
|
||||||
|
|
||||||
// InitLCOW does nothing since LCOW is a windows only feature
|
|
||||||
func InitLCOW(experimental bool) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerdRuntimeSupported returns true if the use of ContainerD runtime is supported.
|
|
||||||
func ContainerdRuntimeSupported(_ bool, _ string) bool {
|
|
||||||
return true
|
|
||||||
}
|
|
|
@ -3,26 +3,15 @@ package system // import "github.com/docker/docker/pkg/system"
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/Microsoft/hcsshim/osversion"
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// lcowSupported determines if Linux Containers on Windows are supported.
|
|
||||||
lcowSupported = false
|
|
||||||
|
|
||||||
// containerdRuntimeSupported determines if ContainerD should be the runtime.
|
// containerdRuntimeSupported determines if ContainerD should be the runtime.
|
||||||
// As of March 2019, this is an experimental feature.
|
// As of March 2019, this is an experimental feature.
|
||||||
containerdRuntimeSupported = false
|
containerdRuntimeSupported = false
|
||||||
)
|
)
|
||||||
|
|
||||||
// InitLCOW sets whether LCOW is supported or not. Requires RS5+
|
|
||||||
func InitLCOW(experimental bool) {
|
|
||||||
if experimental && osversion.Build() >= osversion.RS5 {
|
|
||||||
lcowSupported = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitContainerdRuntime sets whether to use ContainerD for runtime
|
// InitContainerdRuntime sets whether to use ContainerD for runtime
|
||||||
// on Windows. This is an experimental feature still in development, and
|
// on Windows. This is an experimental feature still in development, and
|
||||||
// also requires an environment variable to be set (so as not to turn the
|
// also requires an environment variable to be set (so as not to turn the
|
||||||
|
|
|
@ -1,16 +1,44 @@
|
||||||
|
// +build windows,!no_lcow
|
||||||
|
|
||||||
package system // import "github.com/docker/docker/pkg/system"
|
package system // import "github.com/docker/docker/pkg/system"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/Microsoft/hcsshim/osversion"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// lcowSupported determines if Linux Containers on Windows are supported.
|
||||||
|
lcowSupported = false
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitLCOW sets whether LCOW is supported or not. Requires RS5+
|
||||||
|
func InitLCOW(experimental bool) {
|
||||||
|
if experimental && osversion.Build() >= osversion.RS5 {
|
||||||
|
lcowSupported = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func LCOWSupported() bool {
|
||||||
|
return lcowSupported
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidatePlatform determines if a platform structure is valid.
|
||||||
|
// TODO This is a temporary windows-only function, should be replaced by
|
||||||
|
// comparison of worker capabilities
|
||||||
|
func ValidatePlatform(platform specs.Platform) error {
|
||||||
|
if !IsOSSupported(platform.OS) {
|
||||||
|
return errors.Errorf("unsupported os %s", platform.OS)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// IsOSSupported determines if an operating system is supported by the host
|
// IsOSSupported determines if an operating system is supported by the host
|
||||||
func IsOSSupported(os string) bool {
|
func IsOSSupported(os string) bool {
|
||||||
if strings.EqualFold(runtime.GOOS, os) {
|
if strings.EqualFold("windows", os) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if LCOWSupported() && strings.EqualFold(os, "linux") {
|
if LCOWSupported() && strings.EqualFold(os, "linux") {
|
||||||
|
@ -18,15 +46,3 @@ func IsOSSupported(os string) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidatePlatform determines if a platform structure is valid.
|
|
||||||
// TODO This is a temporary windows-only function, should be replaced by
|
|
||||||
// comparison of worker capabilities
|
|
||||||
func ValidatePlatform(platform specs.Platform) error {
|
|
||||||
if runtime.GOOS == "windows" {
|
|
||||||
if !(platform.OS == runtime.GOOS || (LCOWSupported() && platform.OS == "linux")) {
|
|
||||||
return errors.Errorf("unsupported os %s", platform.OS)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package system // import "github.com/docker/docker/pkg/system"
|
|
||||||
|
|
||||||
// LCOWSupported returns true if Linux containers on Windows are supported.
|
|
||||||
func LCOWSupported() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// +build !windows windows,no_lcow
|
||||||
|
|
||||||
|
package system // import "github.com/docker/docker/pkg/system"
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitLCOW does nothing since LCOW is a windows only feature
|
||||||
|
func InitLCOW(_ bool) {}
|
||||||
|
|
||||||
|
// LCOWSupported returns true if Linux containers on Windows are supported.
|
||||||
|
func LCOWSupported() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidatePlatform determines if a platform structure is valid. This function
|
||||||
|
// is used for LCOW, and is a no-op on non-windows platforms.
|
||||||
|
func ValidatePlatform(_ specs.Platform) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsOSSupported determines if an operating system is supported by the host.
|
||||||
|
func IsOSSupported(os string) bool {
|
||||||
|
return strings.EqualFold(runtime.GOOS, os)
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
package system // import "github.com/docker/docker/pkg/system"
|
|
||||||
|
|
||||||
// LCOWSupported returns true if Linux containers on Windows are supported.
|
|
||||||
func LCOWSupported() bool {
|
|
||||||
return lcowSupported
|
|
||||||
}
|
|
|
@ -191,6 +191,12 @@ NOTE: if you need to set more than one build tag, space separate them:
|
||||||
export DOCKER_BUILDTAGS='apparmor selinux exclude_graphdriver_aufs'
|
export DOCKER_BUILDTAGS='apparmor selinux exclude_graphdriver_aufs'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### LCOW (Linux Containers On Windows)
|
||||||
|
|
||||||
|
LCOW is an experimental feature on Windows, and requires the daemon to run with
|
||||||
|
experimental features enabled. Use the `no_lcow` build tag to disable the LCOW
|
||||||
|
feature at compile time,
|
||||||
|
|
||||||
### Static Daemon
|
### Static Daemon
|
||||||
|
|
||||||
If it is feasible within the constraints of your distribution, you should
|
If it is feasible within the constraints of your distribution, you should
|
||||||
|
|
Loading…
Reference in New Issue