Browse Source

Merge pull request #26965 from Microsoft/jjh/rootpath

Windows: Set correct root path logic
Vincent Demeester 8 years ago
parent
commit
15fb3fd9da
1 changed files with 13 additions and 3 deletions
  1. 13 3
      daemon/oci_windows.go

+ 13 - 3
daemon/oci_windows.go

@@ -64,9 +64,19 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
 	s.Process.Terminal = c.Config.Tty
 	s.Process.Terminal = c.Config.Tty
 	s.Process.User.Username = c.Config.User
 	s.Process.User.Username = c.Config.User
 
 
-	// In spec.Root
-	s.Root.Path = c.BaseFS
-	s.Root.Readonly = c.HostConfig.ReadonlyRootfs
+	// In spec.Root. This is not set for Hyper-V containers
+	isHyperV := false
+	if c.HostConfig.Isolation.IsDefault() {
+		// Container using default isolation, so take the default from the daemon configuration
+		isHyperV = daemon.defaultIsolation.IsHyperV()
+	} else {
+		// Container may be requesting an explicit isolation mode.
+		isHyperV = c.HostConfig.Isolation.IsHyperV()
+	}
+	if !isHyperV {
+		s.Root.Path = c.BaseFS
+	}
+	s.Root.Readonly = false // Windows does not support a read-only root filesystem
 
 
 	// In s.Windows.Resources
 	// In s.Windows.Resources
 	// @darrenstahlmsft implement these resources
 	// @darrenstahlmsft implement these resources