Browse code

LCOW: commit to use image platform, not host

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2017/05/18 04:01:43
Showing 3 changed files
... ...
@@ -84,7 +84,7 @@ func (b *Builder) exportImage(state *dispatchState, imageMount *imageMount, runC
84 84
 		ContainerConfig: runConfig,
85 85
 		DiffID:          newLayer.DiffID(),
86 86
 		Config:          copyRunConfig(state.runConfig),
87
-	})
87
+	}, parentImage.OS)
88 88
 
89 89
 	// TODO: it seems strange to marshal this here instead of just passing in the
90 90
 	// image struct
... ...
@@ -188,7 +188,7 @@ func (daemon *Daemon) Commit(name string, c *backend.ContainerCommitConfig) (str
188 188
 		Config:          newConfig,
189 189
 		DiffID:          l.DiffID(),
190 190
 	}
191
-	config, err := json.Marshal(image.NewChildImage(parent, cc))
191
+	config, err := json.Marshal(image.NewChildImage(parent, cc, container.Platform))
192 192
 	if err != nil {
193 193
 		return "", err
194 194
 	}
... ...
@@ -135,7 +135,7 @@ type ChildConfig struct {
135 135
 }
136 136
 
137 137
 // NewChildImage creates a new Image as a child of this image.
138
-func NewChildImage(img *Image, child ChildConfig) *Image {
138
+func NewChildImage(img *Image, child ChildConfig, platform string) *Image {
139 139
 	isEmptyLayer := layer.IsEmpty(child.DiffID)
140 140
 	rootFS := img.RootFS
141 141
 	if rootFS == nil {
... ...
@@ -155,7 +155,7 @@ func NewChildImage(img *Image, child ChildConfig) *Image {
155 155
 			DockerVersion:   dockerversion.Version,
156 156
 			Config:          child.Config,
157 157
 			Architecture:    runtime.GOARCH,
158
-			OS:              runtime.GOOS,
158
+			OS:              platform,
159 159
 			Container:       child.ContainerID,
160 160
 			ContainerConfig: *child.ContainerConfig,
161 161
 			Author:          child.Author,