From 8f5378069444fba89e43b95e95d5ac630b33d90b Mon Sep 17 00:00:00 2001 From: John Howard Date: Wed, 17 May 2017 12:01:43 -0700 Subject: [PATCH] LCOW: commit to use image platform, not host Signed-off-by: John Howard --- builder/dockerfile/internals.go | 2 +- daemon/commit.go | 2 +- image/image.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/dockerfile/internals.go b/builder/dockerfile/internals.go index 213e64a52e..54e19e9004 100644 --- a/builder/dockerfile/internals.go +++ b/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 diff --git a/daemon/commit.go b/daemon/commit.go index 51089b6162..adf253a38c 100644 --- a/daemon/commit.go +++ b/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 } diff --git a/image/image.go b/image/image.go index 34ad2e6786..ab95d93dab 100644 --- a/image/image.go +++ b/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,