diff options
author | Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> | 2018-04-26 20:06:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-26 20:06:40 +0200 |
commit | fef1a5ea809976d0d3d2160f3e0a4459e6482763 (patch) | |
tree | 73c5b9f521ae0953b2f65273176469c78b6bf715 /image | |
parent | b87bda893b48edcda2de38547216bcb480dba7fe (diff) | |
parent | 92b17b10bad1f1788419b70db5d6ed9cdf8d15ef (diff) | |
download | docker-fef1a5ea809976d0d3d2160f3e0a4459e6482763.tar.gz |
Merge pull request #36816 from arm64b/using-parent-img-arch4dockerbuilder
Dockerbuilder: use the arch info from base image
Diffstat (limited to 'image')
-rw-r--r-- | image/image.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/image/image.go b/image/image.go index 683c3fedd0..7e0646f072 100644 --- a/image/image.go +++ b/image/image.go @@ -96,6 +96,15 @@ func (img *Image) RunConfig() *container.Config { return img.Config } +// BaseImgArch returns the image's architecture. If not populated, defaults to the host runtime arch. +func (img *Image) BaseImgArch() string { + arch := img.Architecture + if arch == "" { + arch = runtime.GOARCH + } + return arch +} + // OperatingSystem returns the image's operating system. If not populated, defaults to the host runtime OS. func (img *Image) OperatingSystem() string { os := img.OS @@ -157,7 +166,7 @@ func NewChildImage(img *Image, child ChildConfig, platform string) *Image { V1Image: V1Image{ DockerVersion: dockerversion.Version, Config: child.Config, - Architecture: runtime.GOARCH, + Architecture: img.BaseImgArch(), OS: platform, Container: child.ContainerID, ContainerConfig: *child.ContainerConfig, |