Skip to content

Commit e8d4c0e

Browse files
committed
plugin docker: Fix arch string used for container metadata to be compliant with the standard
Fixes: RHBZ#1793927
1 parent a49d087 commit e8d4c0e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

imagefactory_plugins/Docker/Docker.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ class Docker(object):
4040
"gzip": "gzip -c %s > %s",
4141
"bzip2": "bzip2 -c %s > %s" }
4242

43+
# In image metadata, Go arch is used to identify the architecture
44+
# https://docs.docker.com/registry/spec/manifest-v2-2/
45+
goarchs = { "x86_64": "amd64",
46+
"aarch64": "arm64",
47+
"armv7hl": "armhfp",
48+
"riscv64": "riscv64",
49+
"ppc64le": "ppc64le",
50+
"s390x": "s390x"}
51+
4352
# The templates below allow us to generate base images without a running docker locally
4453

4554
# [email protected] - 26-Aug-2014
@@ -385,7 +394,7 @@ def _run_guestmount(g):
385394
if set_arch_label:
386395
if label == 'null':
387396
label = dict()
388-
label["architecture"] = tdlobj.arch
397+
label["architecture"] = self.goarchs[tdlobj.arch]
389398

390399
rdict = { repository: { tag: docker_image_id } }
391400

@@ -394,16 +403,11 @@ def _run_guestmount(g):
394403
raise Exception("No docker JSON template available for specified docker version (%s)" % (dockerversion))
395404
docker_json_template=self.docker_templates_dict[dockerversion]
396405

397-
arch = tdlobj.arch
398-
if arch == "x86_64":
399-
arch = "amd64"
400-
elif arch == "armv7hl":
401-
arch = "armhfp"
402406
tdict = { }
403407
tdict['commentstring'] = parameters.get('comment', 'Created by Image Factory')
404408
tdict['os'] = parameters.get('os', 'linux')
405409
tdict['createdtime'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
406-
tdict['arch'] = arch
410+
tdict['arch'] = self.goarchs[tdlobj.arch]
407411
tdict['idstring'] = docker_image_id
408412
tdict['cmd'] = cmd
409413
tdict['env'] = env

0 commit comments

Comments
 (0)