Bläddra i källkod

LCOW: commit to use image platform, not host

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard 8 år sedan
förälder
incheckning
8f53780694
3 ändrade filer med 4 tillägg och 4 borttagningar
  1. 1 1
      builder/dockerfile/internals.go
  2. 1 1
      daemon/commit.go
  3. 2 2
      image/image.go

+ 1 - 1
builder/dockerfile/internals.go

@@ -84,7 +84,7 @@ func (b *Builder) exportImage(state *dispatchState, imageMount *imageMount, runC
 		ContainerConfig: runConfig,
 		DiffID:          newLayer.DiffID(),
 		Config:          copyRunConfig(state.runConfig),
-	})
+	}, parentImage.OS)
 
 	// TODO: it seems strange to marshal this here instead of just passing in the
 	// image struct

+ 1 - 1
daemon/commit.go

@@ -188,7 +188,7 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
 		Config:          newConfig,
 		DiffID:          l.DiffID(),
 	}
-	config, err := json.Marshal(image.NewChildImage(parent, cc))
+	config, err := json.Marshal(image.NewChildImage(parent, cc, container.Platform))
 	if err != nil {
 		return "", err
 	}

+ 2 - 2
image/image.go

@@ -135,7 +135,7 @@ type ChildConfig struct {
 }
 
 // NewChildImage creates a new Image as a child of this image.
-func NewChildImage(img *Image, child ChildConfig) *Image {
+func NewChildImage(img *Image, child ChildConfig, platform string) *Image {
 	isEmptyLayer := layer.IsEmpty(child.DiffID)
 	rootFS := img.RootFS
 	if rootFS == nil {
@@ -155,7 +155,7 @@ func NewChildImage(img *Image, child ChildConfig) *Image {
 			DockerVersion:   dockerversion.Version,
 			Config:          child.Config,
 			Architecture:    runtime.GOARCH,
-			OS:              runtime.GOOS,
+			OS:              platform,
 			Container:       child.ContainerID,
 			ContainerConfig: *child.ContainerConfig,
 			Author:          child.Author,