1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Windows: Fix Hyper-V containers regression from 36586

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2018-03-15 15:36:36 -07:00
parent 3d14173a29
commit 0f5fe3f9cf

View file

@ -221,9 +221,6 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
// Sets the Windows-specific fields of the OCI spec // Sets the Windows-specific fields of the OCI spec
func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.Spec, isHyperV bool) error { 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 { if len(s.Process.Cwd) == 0 {
// We default to C:\ to workaround the oddity of the case that the // We default to C:\ to workaround the oddity of the case that the
// default directory for cmd running as LocalSystem (or // 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 s.Root.Readonly = false // Windows does not support a read-only root filesystem
if !isHyperV { 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 s.Root.Path = c.BaseFS.Path() // This is not set for Hyper-V containers
if !strings.HasSuffix(s.Root.Path, `\`) { if !strings.HasSuffix(s.Root.Path, `\`) {
s.Root.Path = s.Root.Path + `\` // Ensure a correctly formatted volume GUID path \\?\Volume{GUID}\ s.Root.Path = s.Root.Path + `\` // Ensure a correctly formatted volume GUID path \\?\Volume{GUID}\