Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -145,7 +145,7 @@ func (d *dispatchRequest) getImageMount(imageRefOrID string) (*imageMount, error |
| 145 | 145 |
imageRefOrID = stage.Image |
| 146 | 146 |
localOnly = true |
| 147 | 147 |
} |
| 148 |
- return d.builder.imageSources.Get(imageRefOrID, localOnly, d.state.baseImage.OperatingSystem()) |
|
| 148 |
+ return d.builder.imageSources.Get(imageRefOrID, localOnly, d.state.operatingSystem) |
|
| 149 | 149 |
} |
| 150 | 150 |
|
| 151 | 151 |
// FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name] |
| ... | ... |
@@ -288,7 +288,7 @@ func dispatchOnbuild(d dispatchRequest, c *instructions.OnbuildCommand) error {
|
| 288 | 288 |
func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
| 289 | 289 |
runConfig := d.state.runConfig |
| 290 | 290 |
var err error |
| 291 |
- runConfig.WorkingDir, err = normalizeWorkdir(d.state.baseImage.OperatingSystem(), runConfig.WorkingDir, c.Path) |
|
| 291 |
+ runConfig.WorkingDir, err = normalizeWorkdir(d.state.operatingSystem, runConfig.WorkingDir, c.Path) |
|
| 292 | 292 |
if err != nil {
|
| 293 | 293 |
return err |
| 294 | 294 |
} |
| ... | ... |
@@ -304,7 +304,7 @@ func dispatchWorkdir(d dispatchRequest, c *instructions.WorkdirCommand) error {
|
| 304 | 304 |
} |
| 305 | 305 |
|
| 306 | 306 |
comment := "WORKDIR " + runConfig.WorkingDir |
| 307 |
- runConfigWithCommentCmd := copyRunConfig(runConfig, withCmdCommentString(comment, d.state.baseImage.OperatingSystem())) |
|
| 307 |
+ runConfigWithCommentCmd := copyRunConfig(runConfig, withCmdCommentString(comment, d.state.operatingSystem)) |
|
| 308 | 308 |
containerID, err := d.builder.probeAndCreate(d.state, runConfigWithCommentCmd) |
| 309 | 309 |
if err != nil || containerID == "" {
|
| 310 | 310 |
return err |
| ... | ... |
@@ -339,7 +339,7 @@ func dispatchRun(d dispatchRequest, c *instructions.RunCommand) error {
|
| 339 | 339 |
return system.ErrNotSupportedOperatingSystem |
| 340 | 340 |
} |
| 341 | 341 |
stateRunConfig := d.state.runConfig |
| 342 |
- cmdFromArgs := resolveCmdLine(c.ShellDependantCmdLine, stateRunConfig, d.state.baseImage.OperatingSystem()) |
|
| 342 |
+ cmdFromArgs := resolveCmdLine(c.ShellDependantCmdLine, stateRunConfig, d.state.operatingSystem) |
|
| 343 | 343 |
buildArgs := d.state.buildArgs.FilterAllowed(stateRunConfig.Env) |
| 344 | 344 |
|
| 345 | 345 |
saveCmd := cmdFromArgs |
| ... | ... |
@@ -420,7 +420,7 @@ func prependEnvOnCmd(buildArgs *buildArgs, buildArgVars []string, cmd strslice.S |
| 420 | 420 |
// |
| 421 | 421 |
func dispatchCmd(d dispatchRequest, c *instructions.CmdCommand) error {
|
| 422 | 422 |
runConfig := d.state.runConfig |
| 423 |
- cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.baseImage.OperatingSystem()) |
|
| 423 |
+ cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem) |
|
| 424 | 424 |
runConfig.Cmd = cmd |
| 425 | 425 |
// set config as already being escaped, this prevents double escaping on windows |
| 426 | 426 |
runConfig.ArgsEscaped = true |
| ... | ... |
@@ -463,7 +463,7 @@ func dispatchHealthcheck(d dispatchRequest, c *instructions.HealthCheckCommand) |
| 463 | 463 |
// |
| 464 | 464 |
func dispatchEntrypoint(d dispatchRequest, c *instructions.EntrypointCommand) error {
|
| 465 | 465 |
runConfig := d.state.runConfig |
| 466 |
- cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.baseImage.OperatingSystem()) |
|
| 466 |
+ cmd := resolveCmdLine(c.ShellDependantCmdLine, runConfig, d.state.operatingSystem) |
|
| 467 | 467 |
runConfig.Entrypoint = cmd |
| 468 | 468 |
if !d.state.cmdSet {
|
| 469 | 469 |
runConfig.Cmd = nil |
| ... | ... |
@@ -37,7 +37,7 @@ import ( |
| 37 | 37 |
|
| 38 | 38 |
func dispatch(d dispatchRequest, cmd instructions.Command) (err error) {
|
| 39 | 39 |
if c, ok := cmd.(instructions.PlatformSpecific); ok {
|
| 40 |
- err := c.CheckPlatform(d.state.baseImage.OperatingSystem()) |
|
| 40 |
+ err := c.CheckPlatform(d.state.operatingSystem) |
|
| 41 | 41 |
if err != nil {
|
| 42 | 42 |
return errdefs.InvalidParameter(err) |
| 43 | 43 |
} |
| ... | ... |
@@ -83,7 +83,7 @@ func (b *Builder) commit(dispatchState *dispatchState, comment string) error {
|
| 83 | 83 |
return errors.New("Please provide a source image with `from` prior to commit")
|
| 84 | 84 |
} |
| 85 | 85 |
|
| 86 |
- runConfigWithCommentCmd := copyRunConfig(dispatchState.runConfig, withCmdComment(comment, dispatchState.baseImage.OperatingSystem())) |
|
| 86 |
+ runConfigWithCommentCmd := copyRunConfig(dispatchState.runConfig, withCmdComment(comment, dispatchState.operatingSystem)) |
|
| 87 | 87 |
hit, err := b.probeCache(dispatchState, runConfigWithCommentCmd) |
| 88 | 88 |
if err != nil || hit {
|
| 89 | 89 |
return err |
| ... | ... |
@@ -165,13 +165,13 @@ func (b *Builder) performCopy(state *dispatchState, inst copyInstruction) error |
| 165 | 165 |
// TODO: should this have been using origPaths instead of srcHash in the comment? |
| 166 | 166 |
runConfigWithCommentCmd := copyRunConfig( |
| 167 | 167 |
state.runConfig, |
| 168 |
- withCmdCommentString(commentStr, state.baseImage.OperatingSystem())) |
|
| 168 |
+ withCmdCommentString(commentStr, state.operatingSystem)) |
|
| 169 | 169 |
hit, err := b.probeCache(state, runConfigWithCommentCmd) |
| 170 | 170 |
if err != nil || hit {
|
| 171 | 171 |
return err |
| 172 | 172 |
} |
| 173 | 173 |
|
| 174 |
- imageMount, err := b.imageSources.Get(state.imageID, true, state.baseImage.OperatingSystem()) |
|
| 174 |
+ imageMount, err := b.imageSources.Get(state.imageID, true, state.operatingSystem) |
|
| 175 | 175 |
if err != nil {
|
| 176 | 176 |
return errors.Wrapf(err, "failed to get destination image %q", state.imageID) |
| 177 | 177 |
} |
| ... | ... |
@@ -182,7 +182,7 @@ func (b *Builder) performCopy(state *dispatchState, inst copyInstruction) error |
| 182 | 182 |
} |
| 183 | 183 |
defer rwLayer.Release() |
| 184 | 184 |
|
| 185 |
- destInfo, err := createDestInfo(state.runConfig.WorkingDir, inst, rwLayer, state.baseImage.OperatingSystem()) |
|
| 185 |
+ destInfo, err := createDestInfo(state.runConfig.WorkingDir, inst, rwLayer, state.operatingSystem) |
|
| 186 | 186 |
if err != nil {
|
| 187 | 187 |
return err |
| 188 | 188 |
} |
| ... | ... |
@@ -7,6 +7,7 @@ import ( |
| 7 | 7 |
"github.com/docker/distribution/reference" |
| 8 | 8 |
"github.com/docker/docker/api/types/image" |
| 9 | 9 |
"github.com/docker/docker/layer" |
| 10 |
+ "github.com/docker/docker/pkg/system" |
|
| 10 | 11 |
) |
| 11 | 12 |
|
| 12 | 13 |
// ImageHistory returns a slice of ImageHistory structures for the specified image |
| ... | ... |
@@ -31,7 +32,9 @@ func (i *ImageService) ImageHistory(name string) ([]*image.HistoryResponseItem, |
| 31 | 31 |
if len(img.RootFS.DiffIDs) <= layerCounter {
|
| 32 | 32 |
return nil, fmt.Errorf("too many non-empty layers in History section")
|
| 33 | 33 |
} |
| 34 |
- |
|
| 34 |
+ if !system.IsOSSupported(img.OperatingSystem()) {
|
|
| 35 |
+ return nil, system.ErrNotSupportedOperatingSystem |
|
| 36 |
+ } |
|
| 35 | 37 |
rootFS.Append(img.RootFS.DiffIDs[layerCounter]) |
| 36 | 38 |
l, err := i.layerStores[img.OperatingSystem()].Get(rootFS.ChainID()) |
| 37 | 39 |
if err != nil {
|
| ... | ... |
@@ -271,7 +271,9 @@ func (i *ImageService) SquashImage(id, parent string) (string, error) {
|
| 271 | 271 |
rootFS := image.NewRootFS() |
| 272 | 272 |
parentImg = &image.Image{RootFS: rootFS}
|
| 273 | 273 |
} |
| 274 |
- |
|
| 274 |
+ if !system.IsOSSupported(img.OperatingSystem()) {
|
|
| 275 |
+ return "", errors.Wrap(err, system.ErrNotSupportedOperatingSystem.Error()) |
|
| 276 |
+ } |
|
| 275 | 277 |
l, err := i.layerStores[img.OperatingSystem()].Get(img.RootFS.ChainID()) |
| 276 | 278 |
if err != nil {
|
| 277 | 279 |
return "", errors.Wrap(err, "error getting image layer") |