These fields are needed to specify the exact version of Windows that an image can run on. They may be useful for other platforms in the future. This also changes image.store.Create to validate that the loaded image is supported on the current machine. This change affects Linux as well, since it now validates the architecture and OS fields. Signed-off-by: John Starks <jostarks@microsoft.com> Upstream-commit: 194eaa5c0f843257e66b68bd735786308a9d93b2 Component: engine
28 lines
469 B
Go
28 lines
469 B
Go
package image
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/docker/docker/pkg/system"
|
|
)
|
|
|
|
// Windows OS features
|
|
const (
|
|
FeatureWin32k = "win32k" // The kernel windowing stack is required
|
|
)
|
|
|
|
func getOSVersion() string {
|
|
v := system.GetOSVersion()
|
|
return fmt.Sprintf("%d.%d.%d", v.MajorVersion, v.MinorVersion, v.Build)
|
|
}
|
|
|
|
func hasOSFeature(f string) bool {
|
|
switch f {
|
|
case FeatureWin32k:
|
|
return system.HasWin32KSupport()
|
|
default:
|
|
// Unrecognized feature.
|
|
return false
|
|
}
|
|
}
|