Browse code

Windows: Set correct root path logic

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/09/28 06:52:49
Showing 1 changed files
... ...
@@ -65,9 +65,19 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
65 65
 	s.Process.Terminal = c.Config.Tty
66 66
 	s.Process.User.Username = c.Config.User
67 67
 
68
-	// In spec.Root
69
-	s.Root.Path = c.BaseFS
70
-	s.Root.Readonly = c.HostConfig.ReadonlyRootfs
68
+	// In spec.Root. This is not set for Hyper-V containers
69
+	isHyperV := false
70
+	if c.HostConfig.Isolation.IsDefault() {
71
+		// Container using default isolation, so take the default from the daemon configuration
72
+		isHyperV = daemon.defaultIsolation.IsHyperV()
73
+	} else {
74
+		// Container may be requesting an explicit isolation mode.
75
+		isHyperV = c.HostConfig.Isolation.IsHyperV()
76
+	}
77
+	if !isHyperV {
78
+		s.Root.Path = c.BaseFS
79
+	}
80
+	s.Root.Readonly = false // Windows does not support a read-only root filesystem
71 81
 
72 82
 	// In s.Windows.Resources
73 83
 	// @darrenstahlmsft implement these resources