听!布鲁布鲁,大鱼又在那叨叨了

如何构建共享标签的多架构docker镜像

1
docker login
1
vim ~/.docker/config.json
1
"experimental": "enabled"
1
docker manifest create is only supported on a Docker cli with experimental cli features enabled
1
docker build -t newnius/rsync:arm64 .
1
2
3
4
5
6
7
$ docker manifest create newnius/rsync:latest newnius/rsync:arm64 newnius/rsync:amd64
Created manifest list docker.io/newnius/rsync:latest

$ docker manifest annotate newnius/rsync:latest newnius/rsync:arm64 --os linux --arch arm64

docker manifest push newnius/rsync:latest
sha256:bd0af18dae521dbf48bbf980e9cb5872d5f95ff8164ebc9639d1f096f4ae51db
1
rm -rf ~/.docker/manifests

https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux/

docker login

export DOCKER_CLI_EXPERIMENTAL=enabled

or

1
2
3
4
5
6
mkdir -p ~/.docker/
vim ~/.docker/config.json



"experimental": "enabled"

docker info | grep Experimental
Experimental: true

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
newnius@virmach-ny:~$ cat /proc/sys/fs/binfmt_misc/qemu-aarch64
cat: /proc/sys/fs/binfmt_misc/qemu-aarch64: No such file or directory
newnius@virmach-ny:~$
newnius@virmach-ny:~$
newnius@virmach-ny:~$ docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
Unable to find image 'docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64' locally
a7996909642ee92942dcd6cff44b9b95f08dad64: Pulling from docker/binfmt
5d6ca6c8ba77: Pull complete
b26a8e2c75fc: Pull complete
3436361ddd98: Pull complete
Digest: sha256:758ca0563f371b384cfd67b6590b5be2dc024fef45bc14a050ae104f0caad14e
Status: Downloaded newer image for docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
newnius@virmach-ny:~$ cat /proc/sys/fs/binfmt_misc/qemu-aarch64
enabled
interpreter /usr/bin/qemu-aarch64
flags: OCF
offset 0
magic 7f454c460201010000000000000000000200b7
mask ffffffffffffff00fffffffffffffffffeffff