From f89e535fb81990f4f6c611bdcce511db6023f9fa Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 15 Mar 2018 15:36:36 -0700 Subject: [PATCH] Windows: Fix Hyper-V containers regression from 36586 Signed-off-by: John Howard Upstream-commit: 0f5fe3f9cf17457761dab28473ece5a7c94f4a0c Component: engine --- components/engine/daemon/oci_windows.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/engine/daemon/oci_windows.go b/components/engine/daemon/oci_windows.go index 6f65c15fb4..edea2bcedc 100644 --- a/components/engine/daemon/oci_windows.go +++ b/components/engine/daemon/oci_windows.go @@ -221,9 +221,6 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) { // Sets the Windows-specific fields of the OCI spec func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.Spec, isHyperV bool) error { - if c.BaseFS == nil { - return errors.New("createSpecWindowsFields: BaseFS of container " + c.ID + " is unexpectedly nil") - } if len(s.Process.Cwd) == 0 { // We default to C:\ to workaround the oddity of the case that the // default directory for cmd running as LocalSystem (or @@ -237,6 +234,10 @@ func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.S s.Root.Readonly = false // Windows does not support a read-only root filesystem if !isHyperV { + if c.BaseFS == nil { + return errors.New("createSpecWindowsFields: BaseFS of container " + c.ID + " is unexpectedly nil") + } + s.Root.Path = c.BaseFS.Path() // This is not set for Hyper-V containers if !strings.HasSuffix(s.Root.Path, `\`) { s.Root.Path = s.Root.Path + `\` // Ensure a correctly formatted volume GUID path \\?\Volume{GUID}\