You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
windows: daemon: allow pulling/running of newer images under Hyper-V.
Following the addition of Hyper-V isolation, it should be possible for
Windows hosts to run container images with older/newer OS versions given
a Windows host with the RS5 updates and above.
This patch includes the following changes:
- [distribution/pull_v2] enable pulling images newer than the host on RS5+
- [daemon/create] add version checks which prevent running newer/older
images unless using Hyper-V isolation
Previously, pulling a Windows image with a newer OS version than the
host was prevented by moby#36327, whose behavior is preserved on
pre-RS5 hosts.
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
// same image version should run on identically-versioned host regardless of isolation:
121
+
logrus.Debugf("image version %s is trivially compatible with host version %s", truncatedImageOSVersion, hostOSV.ToString())
122
+
returnnil
123
+
} elseifimageOSBuild<hostOSV.Build {
124
+
// images older than the host must be run under Hyper-V:
125
+
ifisHyperV {
126
+
logrus.Debugf("older image version %s is compatible with host version %s under Hyper-V", truncatedImageOSVersion, hostOSV.ToString())
127
+
returnnil
128
+
} else {
129
+
returnfmt.Errorf("an older Windows version %s-based image can only be run on a %s host using Hyper-V isolation", truncatedImageOSVersion, hostOSV.ToString())
130
+
}
131
+
} else {
132
+
// images newer than the host can only run if the host is RS5 and is using Hyper-V:
133
+
ifhostOSV.Build<osversion.RS5 {
134
+
returnfmt.Errorf("a Windows version %s-based image is incompatible with a %s host", truncatedImageOSVersion, hostOSV.ToString())
135
+
} else {
136
+
ifisHyperV {
137
+
logrus.Debugf("newer Windows image version %s is compatible with host version %s under Hyper-V", truncatedImageOSVersion, hostOSV.ToString())
138
+
returnnil
139
+
} else {
140
+
returnfmt.Errorf("a newer Windows version %s-based image can only be run on a %s host using Hyper-V isolation", truncatedImageOSVersion, hostOSV.ToString())
errMsg:=fmt.Sprintf("a Windows version %s.%s.%s-based image is incompatible with a %s host", splitImageOSVersion[0], splitImageOSVersion[1], splitImageOSVersion[2], hostOSV.ToString())
133
140
logrus.Debugf(errMsg)
134
141
returnerrors.New(errMsg)
142
+
} else {
143
+
logrus.Debugf("image version %s.%s.%s is compatible with host version %s", splitImageOSVersion[0], splitImageOSVersion[1], splitImageOSVersion[2], hostOSV.ToString())
135
144
}
136
145
}
146
+
} else {
147
+
logrus.Warnf("failed to split and parse Windows image version %q (was expecting format like '10.0.16299.nnnn')", imageOSVersion)
0 commit comments