My server and docker info. are as follows:
Linux xxx 3.10.0-1160.66.1.el7.x86_64 #1 xxx x86_64 x86_64 x86_64 GNU/Linux
Docker version 20.10.17
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Server Version: 20.10.17
Kernel Version: 3.10.0-1160.66.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
I want to build a docker container by QEMU. I followed the instructions from the official QEMU github. But it gave errors.
$ uname -m
x86_64
$ docker run --rm -t arm64v8/ubuntu uname -m
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
exec /usr/bin/uname: exec format error
Then I found a similar docker problem on stackoverflow. I tried both docker build
and docker buildx
, and it still doesn't work.
$ docker build --platform linux/arm64/v8 .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /work/home/chenning/Dockerfile: no such file or directory
$ docker buildx build --push --platform linux/amd64,linux/arm64 -t <tag> .
-bash: tag: No such file or directory
I also tried the following instruction, but it still reported errors.
$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
sh: write error: Invalid argument
Setting /usr/bin/qemu-alpha-static as binfmt interpreter for alpha
Setting /usr/bin/qemu-arm-static as binfmt interpreter for arm
sh: write error: Invalid argument
Setting /usr/bin/qemu-armeb-static as binfmt interpreter for armeb
sh: write error: Invalid argument
Setting /usr/bin/qemu-sparc-static as binfmt interpreter for sparc
sh: write error: Invalid argument
...
I followed the guide from this link
it works when I try
docker run --rm --privileged multiarch/qemu-user-static:register
I have qemu interpreters (including qemu-aarch64
) in /proc/sys/fs/binfmt_misc
My qemu-aarch64
is like this
enabled
interpreter /usr/bin/qemu-aarch64-static
flags:
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff
but I don't have the permission to change flags
, I also don't have interpreter /usr/bin/qemu-aarch64-static
.
Can I get some help, pls?
I got the same error, but executing this command fixed the issue:
$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
So I can even spawn a shell:
$ docker run -it arm64v8/ubuntu /bin/bash
root@0b6162g03ka5:/# uname -m
aarch64
If it doesn't work take a look at this issue , otherwise you should create a new issue on github
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.