我可以用dockerhub构建arm32 docker文件吗

问题描述 投票:0回答:1

我已将 DockerHub 设置为自动构建存储在 BitBucket 存储库中的 Dockerfile。每次对 Dockerfile 进行修改时,效果都很好 https://bitbucket.org/ijabz/songkongdocker/src/master/Dockerfile

我还有一个单独的存储库https://bitbucket.org/ijabz/songkongdockerarm32/src/master/Dockerfile,它构建了应用程序的arm32版本,我一直在基于arm32的qnap上手动构建它,但我有我的 qnap 出现问题,所以想在 Dockerhub 上构建

我配置了它,但构建失败了,我不清楚我是否必须做一些特殊的事情来构建arm32构建或者它是否不可能

Dockerhub 构建失败如下

2024-06-18T11:34:21Z Cloning into '.'...
2024-06-18T11:34:22Z Warning: Permanently added the ECDSA host key for IP address '18.205.93.0' to the list of known hosts.
2024-06-18T11:34:23Z Reset branch 'master'
2024-06-18T11:34:23Z Your branch is up to date with 'origin/master'.
2024-06-18T11:34:23Z KernelVersion: 5.4.0-1068-aws
2024-06-18T11:34:23Z Components: [{u'Version': u'20.10.15', u'Name': u'Engine', u'Details': {u'KernelVersion': u'5.4.0-1068-aws', u'Os': u'linux', u'BuildTime': u'2022-05-05T13:17:24.000000000+00:00', u'ApiVersion': u'1.41', u'MinAPIVersion': u'1.12', u'GitCommit': u'4433bf6', u'Arch': u'amd64', u'Experimental': u'false', u'GoVersion': u'go1.17.9'}}, {u'Version': u'1.6.21', u'Name': u'containerd', u'Details': {u'GitCommit': u'3dce8eb055cbb6872793272b4f20ed16117344f8'}}, {u'Version': u'1.1.7', u'Name': u'runc', u'Details': {u'GitCommit': u'v1.1.7-0-g860f061'}}, {u'Version': u'0.19.0', u'Name': u'docker-init', u'Details': {u'GitCommit': u'de40ad0'}}]
2024-06-18T11:34:23Z Arch: amd64
2024-06-18T11:34:23Z BuildTime: 2022-05-05T13:17:24.000000000+00:00
2024-06-18T11:34:23Z ApiVersion: 1.41
2024-06-18T11:34:23Z Platform: {u'Name': u'Docker Engine - Community'}
2024-06-18T11:34:23Z Version: 20.10.15
2024-06-18T11:34:23Z MinAPIVersion: 1.12
2024-06-18T11:34:23Z GitCommit: 4433bf6
2024-06-18T11:34:23Z Os: linux
2024-06-18T11:34:23Z GoVersion: go1.17.9
2024-06-18T11:34:23Z Buildkit: Starting build for index.docker.io/songkong/songkong-arm32:latest...
2024-06-18T11:34:30Z #1 [internal] load build definition from Dockerfile
2024-06-18T11:34:30Z #1 transferring dockerfile: 1.01kB done
2024-06-18T11:34:30Z #1 DONE 0.1s
2024-06-18T11:34:30Z 
2024-06-18T11:34:30Z #2 [internal] load .dockerignore
2024-06-18T11:34:30Z #2 transferring context:
2024-06-18T11:34:30Z #2 transferring context: 2B done
2024-06-18T11:34:30Z #2 DONE 0.1s
2024-06-18T11:34:30Z 
2024-06-18T11:34:30Z #3 [auth] library/centos:pull token for registry-1.docker.io
2024-06-18T11:34:30Z #3 DONE 0.0s
2024-06-18T11:34:30Z 
2024-06-18T11:34:30Z #4 [auth] adoptopenjdk/openjdk14:pull token for registry-1.docker.io
2024-06-18T11:34:30Z #4 DONE 0.0s
2024-06-18T11:34:30Z 
2024-06-18T11:34:30Z #5 [internal] load metadata for docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12
2024-06-18T11:34:30Z #5 DONE 0.7s
2024-06-18T11:34:30Z 
2024-06-18T11:34:30Z #6 [internal] load metadata for docker.io/library/centos:7
2024-06-18T11:34:30Z #6 DONE 0.6s
2024-06-18T11:34:31Z 
2024-06-18T11:34:31Z #7 [build 1/4] FROM docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12@sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371
2024-06-18T11:34:31Z #7 resolve docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12@sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371 0.0s done
2024-06-18T11:34:31Z #7 sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371 954B / 954B done
2024-06-18T11:34:31Z #7 sha256:b4789a50a8510ef026ba8cb1b8e0365a69edb4d85fa356ebafb35b7578e0ab3e 5.26kB / 5.26kB done
2024-06-18T11:34:31Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 0B / 70.03MB 0.1s
2024-06-18T11:34:31Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 0B / 66.36MB 0.1s
2024-06-18T11:34:31Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 0B / 198.00MB 0.1s
2024-06-18T11:34:31Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 5.24MB / 70.03MB 0.3s
2024-06-18T11:34:31Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 9.44MB / 66.36MB 0.3s
2024-06-18T11:34:31Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 10.49MB / 70.03MB 0.4s
2024-06-18T11:34:31Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 13.63MB / 66.36MB 0.4s
2024-06-18T11:34:31Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 14.80MB / 70.03MB 0.6s
2024-06-18T11:34:31Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 20.97MB / 66.36MB 0.6s
2024-06-18T11:34:31Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 18.87MB / 70.03MB 0.7s
2024-06-18T11:34:31Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 26.21MB / 66.36MB 0.7s
2024-06-18T11:34:31Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 11.53MB / 198.00MB 0.7s
2024-06-18T11:34:32Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 24.12MB / 70.03MB 0.9s
2024-06-18T11:34:32Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 31.46MB / 66.36MB 0.9s
2024-06-18T11:34:32Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 29.36MB / 70.03MB 1.1s
2024-06-18T11:34:32Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 38.80MB / 66.36MB 1.1s
2024-06-18T11:34:32Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 28.31MB / 198.00MB 1.1s
2024-06-18T11:34:32Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 33.55MB / 70.03MB 1.2s
2024-06-18T11:34:32Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 44.04MB / 70.03MB 1.4s
2024-06-18T11:34:32Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 50.33MB / 66.36MB 1.4s
2024-06-18T11:34:32Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 50.33MB / 70.03MB 1.6s
2024-06-18T11:34:32Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 60.87MB / 66.36MB 1.6s
2024-06-18T11:34:32Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 42.87MB / 198.00MB 1.6s
2024-06-18T11:34:32Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 66.36MB / 66.36MB 1.7s
2024-06-18T11:34:32Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 61.87MB / 70.03MB 1.9s
2024-06-18T11:34:32Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 54.53MB / 198.00MB 1.9s
2024-06-18T11:34:33Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 68.16MB / 70.03MB 2.0s
2024-06-18T11:34:33Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 72.35MB / 198.00MB 2.2s
2024-06-18T11:34:33Z #7 sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 66.36MB / 66.36MB 2.2s done
2024-06-18T11:34:33Z #7 sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 70.03MB / 70.03MB 2.5s done
2024-06-18T11:34:33Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 85.98MB / 198.00MB 2.6s
2024-06-18T11:34:33Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 97.52MB / 198.00MB 2.9s
2024-06-18T11:34:34Z #7 extracting sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af
2024-06-18T11:34:34Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 115.34MB / 198.00MB 3.6s
2024-06-18T11:34:35Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 125.83MB / 198.00MB 4.6s
2024-06-18T11:34:36Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 136.56MB / 198.00MB 5.2s
2024-06-18T11:34:36Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 147.85MB / 198.00MB 5.6s
2024-06-18T11:34:37Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 158.33MB / 198.00MB 6.1s
2024-06-18T11:34:37Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 175.11MB / 198.00MB 6.8s
2024-06-18T11:34:38Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 185.82MB / 198.00MB 7.2s
2024-06-18T11:34:38Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 198.00MB / 198.00MB 7.7s
2024-06-18T11:34:39Z #7 extracting sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 5.2s
2024-06-18T11:34:40Z #7 ...
2024-06-18T11:34:40Z 
2024-06-18T11:34:40Z #8 [stage-1 1/4] FROM docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4
2024-06-18T11:34:40Z #8 resolve docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4 0.0s done
2024-06-18T11:34:40Z #8 sha256:dead07b4d8ed7e29e98de0f4504d87e8880d4347859d839686a31da35a3b532f 529B / 529B done
2024-06-18T11:34:40Z #8 sha256:eeb6ee3f44bd0b5103bb561b4c16bcb82328cfe5809ab675bb17ab3a16c517c9 2.75kB / 2.75kB done
2024-06-18T11:34:40Z #8 sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4 1.20kB / 1.20kB done
2024-06-18T11:34:40Z #8 sha256:2d473b07cdd5f0912cd6f1a703352c82b512407db6b05b43f2553732b55df3bc 76.10MB / 76.10MB 5.8s done
2024-06-18T11:34:40Z #8 extracting sha256:2d473b07cdd5f0912cd6f1a703352c82b512407db6b05b43f2553732b55df3bc 3.1s
2024-06-18T11:34:41Z #8 ...
2024-06-18T11:34:41Z 
2024-06-18T11:34:41Z #7 [build 1/4] FROM docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12@sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371
2024-06-18T11:34:41Z #7 sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 198.00MB / 198.00MB 9.9s done
2024-06-18T11:34:44Z #7 extracting sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 10.4s
2024-06-18T11:34:49Z #7 extracting sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 15.6s
2024-06-18T11:34:50Z #7 ...
2024-06-18T11:34:50Z 
2024-06-18T11:34:50Z #8 [stage-1 1/4] FROM docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4
2024-06-18T11:34:50Z #8 extracting sha256:2d473b07cdd5f0912cd6f1a703352c82b512407db6b05b43f2553732b55df3bc 12.5s
2024-06-18T11:34:50Z #8 ...
2024-06-18T11:34:50Z 
2024-06-18T11:34:50Z #7 [build 1/4] FROM docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12@sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371
2024-06-18T11:34:53Z #7 extracting sha256:193bcbf05ff9ae85ac1a58cacd9c07f8f4297dc648808c347cceb3797ae603af 19.0s done
2024-06-18T11:34:55Z #7 extracting sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a
2024-06-18T11:34:59Z #7 ...
2024-06-18T11:34:59Z 
2024-06-18T11:34:59Z #8 [stage-1 1/4] FROM docker.io/library/centos:7@sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4
2024-06-18T11:34:59Z #8 extracting sha256:2d473b07cdd5f0912cd6f1a703352c82b512407db6b05b43f2553732b55df3bc 19.9s done
2024-06-18T11:34:59Z #8 DONE 28.2s
2024-06-18T11:34:59Z 
2024-06-18T11:34:59Z #7 [build 1/4] FROM docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12@sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371
2024-06-18T11:34:59Z #7 ...
2024-06-18T11:34:59Z 
2024-06-18T11:34:59Z #9 [stage-1 2/4] RUN mkdir -p /opt
2024-06-18T11:35:04Z #9 ...
2024-06-18T11:35:04Z 
2024-06-18T11:35:04Z #7 [build 1/4] FROM docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12@sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371
2024-06-18T11:35:04Z #7 extracting sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 8.6s
2024-06-18T11:35:06Z #7 extracting sha256:83c03e4400804660ec377662b61bf20e68e92abd1a635726b631c1803e63f56a 11.1s done
2024-06-18T11:35:08Z #7 extracting sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e
2024-06-18T11:35:11Z #7 ...
2024-06-18T11:35:11Z 
2024-06-18T11:35:11Z #9 [stage-1 2/4] RUN mkdir -p /opt
2024-06-18T11:35:11Z #9 DONE 12.4s
2024-06-18T11:35:11Z 
2024-06-18T11:35:11Z #7 [build 1/4] FROM docker.io/adoptopenjdk/openjdk14:armv7l-centos-jdk-14.0.2_12@sha256:b4688d55ba6fe65b1810a6e5fbc2bed5e29ce977e696b6d2e9dbe092a44f0371
2024-06-18T11:35:13Z #7 extracting sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 5.1s
2024-06-18T11:35:16Z #7 extracting sha256:0b55b0b0b22c736247c0d6dc7b21b2447811e560821da1daacedd4f669556a2e 7.8s done
2024-06-18T11:35:16Z #7 DONE 45.7s
2024-06-18T11:35:16Z 
2024-06-18T11:35:16Z #10 [build 2/4] RUN /opt/java/openjdk/bin/jlink --module-path=/opt/java/openjdk/jmods --add-modules java.desktop,java.datatransfer,java.logging,java.management,java.naming,java.net.http,java.prefs,java.scripting,java.sql,jdk.management,jdk.unsupported,jdk.jcmd,jdk.crypto.ec,jdk.dynalink --output /opt/songkong/jre
2024-06-18T11:35:17Z #10 0.377 exec /bin/sh: exec format error
2024-06-18T11:35:20Z #10 ERROR: executor failed running [/bin/sh -c /opt/java/openjdk/bin/jlink --module-path=/opt/java/openjdk/jmods --add-modules java.desktop,java.datatransfer,java.logging,java.management,java.naming,java.net.http,java.prefs,java.scripting,java.sql,jdk.management,jdk.unsupported,jdk.jcmd,jdk.crypto.ec,jdk.dynalink --output /opt/songkong/jre]: exit code: 1
2024-06-18T11:35:20Z ------
2024-06-18T11:35:20Z  > [build 2/4] RUN /opt/java/openjdk/bin/jlink --module-path=/opt/java/openjdk/jmods --add-modules java.desktop,java.datatransfer,java.logging,java.management,java.naming,java.net.http,java.prefs,java.scripting,java.sql,jdk.management,jdk.unsupported,jdk.jcmd,jdk.crypto.ec,jdk.dynalink --output /opt/songkong/jre:
2024-06-18T11:35:20Z #10 0.377 exec /bin/sh: exec format error
2024-06-18T11:35:20Z ------
2024-06-18T11:35:20Z ERROR: failed to solve: executor failed running [/bin/sh -c /opt/java/openjdk/bin/jlink --module-path=/opt/java/openjdk/jmods --add-modules java.desktop,java.datatransfer,java.logging,java.management,java.naming,java.net.http,java.prefs,java.scripting,java.sql,jdk.management,jdk.unsupported,jdk.jcmd,jdk.crypto.ec,jdk.dynalink --output /opt/songkong/jre]: exit code: 1
2024-06-18T11:35:20Z Build failed using Buildkit (1)
docker arm dockerhub
1个回答
0
投票

是的,可以在 DockerHub 中构建应用程序的 x86 和 Arm 32 位版本。您的构建失败是因为您正在 x86 硬件上构建 arm/v7 映像,导致架构不匹配,从而创建

exec format error
。有两个通用选项可用于构建多架构映像:

选项 1:在目标架构上单独构建

  • 在其目标架构上分别构建 x86 和 Arm 32 位映像,并通过
    docker manifest
    命令将这些映像组合成一个“多架构映像”。请注意,这要求您的构建过程能够访问 x86 和 Arm 32 位机器。您可以为每个架构使用单独的 Dockerfile(就像现在一样),或者将您的应用程序合并到单个 Dockerfile 中,并通过支持两种架构的多阶段构建。

选项 2:使用 Docker Buildx 进行跨平台构建

  • 在同一台机器(基于 x86)上构建 x86 和 Arm 32 位映像,并使用
    docker buildx
    通过仿真工具 QEMU 创建 Arm 32 位映像。在此选项中,您还可以为每个架构使用单独的 Dockerfile,并使用
    docker manifest
    组合图像,或使用
    docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 \ --tag your-username/multiarch-example:buildx-latest .
  • 等命令组合单个 Dockerfile

要对当前设置进行最少的更改,您应该使用单独的 Dockerfile 采取选项 2。然后,您需要通过三种方式修改 DockerHub 构建步骤 - 安装 QEMU、对 Arm 32 位 Dockerfile 使用

docker buildx
,以及使用
docker manifest
组合 x86 和 Arm 32 位 Docker 映像。

就上下文而言,

buildx
命令是通过 Docker 和 Arm 之间的合作在 DockerCon 2019 上发布的;作为创建它的团队的一员,我可以证明它对您的用例的有用性。

首先,您需要修复针对 Arm 架构的 Dockerfile,因为“centos:7”基础映像仅适用于 x86。您应该将其替换为“arm32v7/centos:7”。


将其分解,您的流程将如下所示:

  1. 有两个独立的 Dockerfile,每个架构一个。
  2. 使用
    docker build
    构建 amd64 映像。
  3. 使用
    docker buildx
    构建arm/v7镜像。
  4. 将两个镜像推送到 DockerHub。
  5. 使用
    docker manifest
    创建并推送多架构清单。

更改 Arm 32 位 Dockerfile 以使用 arm32v7/centos:7 基础映像后,在 DockerHub 中,您可以使用这些命令(稍作更改以匹配您为项目配置的正确名称和存储库):

# Build & push the x86 image
docker build -t username/repository:tag-amd64 -f Dockerfile.amd64 .
docker push username/repository:tag-amd64

# Set up buildx. Inspecting ensures buildx is configured correctly and ready, and the final command runs a container to set up QEMU, enabling the Arm emulation for cross-platform building.
docker buildx create --name mybuilder --use
docker buildx inspect --bootstrap
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

# Build & push the arm/v7 image
docker buildx build --platform linux/arm/v7 -t username/repository:tag-arm32 -f Dockerfile.arm32 --push .


# Create & push the multi-arch manifest combining x86 and arm/v7 images
docker login
docker manifest create username/repository:tag \
  --amend username/repository:tag-amd64 \
  --amend username/repository:tag-arm32

docker manifest push username/repository:tag

当您想在 x86 和 Arm 32 位硬件上运行此映像时,Docker 将自动检测其运行位置并拉取正确的架构版本。您的标准

docker pull username/repository:tag
会很好用。

© www.soinside.com 2019 - 2024. All rights reserved.