github.com/devdivbcp/moby@v17.12.0-ce-rc1.0.20200726071732-2d4bfdc789ad+incompatible/pkg/system/init_windows.go (about)

     1  package system // import "github.com/docker/docker/pkg/system"
     2  
     3  import (
     4  	"os"
     5  
     6  	"github.com/Microsoft/hcsshim/osversion"
     7  	"github.com/sirupsen/logrus"
     8  )
     9  
    10  var (
    11  	// lcowSupported determines if Linux Containers on Windows are supported.
    12  	lcowSupported = false
    13  
    14  	// containerdRuntimeSupported determines if ContainerD should be the runtime.
    15  	// As of March 2019, this is an experimental feature.
    16  	containerdRuntimeSupported = false
    17  )
    18  
    19  // InitLCOW sets whether LCOW is supported or not. Requires RS5+
    20  func InitLCOW(experimental bool) {
    21  	v := GetOSVersion()
    22  	if experimental && v.Build >= osversion.RS5 {
    23  		lcowSupported = true
    24  	}
    25  }
    26  
    27  // InitContainerdRuntime sets whether to use ContainerD for runtime
    28  // on Windows. This is an experimental feature still in development, and
    29  // also requires an environment variable to be set (so as not to turn the
    30  // feature on from simply experimental which would also mean LCOW.
    31  func InitContainerdRuntime(experimental bool, cdPath string) {
    32  	if experimental && len(cdPath) > 0 && len(os.Getenv("DOCKER_WINDOWS_CONTAINERD_RUNTIME")) > 0 {
    33  		logrus.Warnf("Using ContainerD runtime. This feature is experimental")
    34  		containerdRuntimeSupported = true
    35  	}
    36  }
    37  
    38  // ContainerdRuntimeSupported returns true if the use of ContainerD runtime is supported.
    39  func ContainerdRuntimeSupported() bool {
    40  	return containerdRuntimeSupported
    41  }