Skip to content

Commit fef1a5e

Browse files
authored
Merge pull request moby#36816 from arm64b/using-parent-img-arch4dockerbuilder
Dockerbuilder: use the arch info from base image
2 parents b87bda8 + 92b17b1 commit fef1a5e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

image/image.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ func (img *Image) RunConfig() *container.Config {
9696
return img.Config
9797
}
9898

99+
// BaseImgArch returns the image's architecture. If not populated, defaults to the host runtime arch.
100+
func (img *Image) BaseImgArch() string {
101+
arch := img.Architecture
102+
if arch == "" {
103+
arch = runtime.GOARCH
104+
}
105+
return arch
106+
}
107+
99108
// OperatingSystem returns the image's operating system. If not populated, defaults to the host runtime OS.
100109
func (img *Image) OperatingSystem() string {
101110
os := img.OS
@@ -157,7 +166,7 @@ func NewChildImage(img *Image, child ChildConfig, platform string) *Image {
157166
V1Image: V1Image{
158167
DockerVersion: dockerversion.Version,
159168
Config: child.Config,
160-
Architecture: runtime.GOARCH,
169+
Architecture: img.BaseImgArch(),
161170
OS: platform,
162171
Container: child.ContainerID,
163172
ContainerConfig: *child.ContainerConfig,

0 commit comments

Comments
 (0)