|
@@ -11,6 +11,7 @@ import (
|
|
|
"github.com/docker/docker/daemon/execdriver"
|
|
|
"github.com/docker/docker/dockerversion"
|
|
|
"github.com/docker/docker/pkg/parsers"
|
|
|
+ "github.com/docker/docker/runconfig"
|
|
|
)
|
|
|
|
|
|
// This is a daemon development variable only and should not be
|
|
@@ -21,6 +22,12 @@ var dummyMode bool
|
|
|
// This allows the daemon to force kill (HCS terminate) rather than shutdown
|
|
|
var forceKill bool
|
|
|
|
|
|
+// defaultIsolation allows users to specify a default isolation mode for
|
|
|
+// when running a container on Windows. For example docker daemon -D
|
|
|
+// --exec-opt isolation=hyperv will cause Windows to always run containers
|
|
|
+// as Hyper-V containers unless otherwise specified.
|
|
|
+var defaultIsolation runconfig.IsolationLevel = "process"
|
|
|
+
|
|
|
// Define name and version for windows
|
|
|
var (
|
|
|
DriverName = "Windows 1854"
|
|
@@ -42,7 +49,7 @@ type Driver struct {
|
|
|
|
|
|
// Name implements the exec driver Driver interface.
|
|
|
func (d *Driver) Name() string {
|
|
|
- return fmt.Sprintf("%s %s", DriverName, Version)
|
|
|
+ return fmt.Sprintf("\n Name: %s\n Build: %s \n Default Isolation: %s", DriverName, Version, defaultIsolation)
|
|
|
}
|
|
|
|
|
|
// NewDriver returns a new windows driver, called from NewDriver of execdriver.
|
|
@@ -70,6 +77,14 @@ func NewDriver(root, initPath string, options []string) (*Driver, error) {
|
|
|
logrus.Warn("Using force kill mode in Windows exec driver. This is for testing purposes only.")
|
|
|
}
|
|
|
|
|
|
+ case "isolation":
|
|
|
+ if !runconfig.IsolationLevel(val).IsValid() {
|
|
|
+ return nil, fmt.Errorf("Unrecognised exec driver option 'isolation':'%s'", val)
|
|
|
+ }
|
|
|
+ if runconfig.IsolationLevel(val).IsHyperV() {
|
|
|
+ defaultIsolation = "hyperv"
|
|
|
+ }
|
|
|
+ logrus.Infof("Windows default isolation level: '%s'", val)
|
|
|
default:
|
|
|
return nil, fmt.Errorf("Unrecognised exec driver option %s\n", key)
|
|
|
}
|