Repository navigation
Closed
Labels
Description
I'm using buildx to do multiplatform builds in our CI environment and recently we started getting some odd errors. I'm able to reproduce this locally with this simple Dockerfile:
FROM amazonlinux
RUN yum -y update
I set up my multiplatform build this way:
docker buildx create --platform linux/amd64,linux/arm64 --use
Then run the build command. When I run it in multi-platform, I get an error:
[vagrant@vagrant temp]$ docker buildx build --pull --no-cache --platform linux/amd64,linux/arm64 -t motus/testbuild .
WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 0.8s (8/8) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [linux/arm64 internal] load metadata for docker.io/library/amazonlinux:latest 0.1s
=> [linux/amd64 internal] load metadata for docker.io/library/amazonlinux:latest 0.1s
=> CACHED [linux/amd64 1/2] FROM docker.io/library/amazonlinux@sha256:ed6a24ee79bb52f2308a20fb20e48b73cfa0b65e89d8a84b6eb68738d4a16152 0.0s
=> => resolve docker.io/library/amazonlinux@sha256:ed6a24ee79bb52f2308a20fb20e48b73cfa0b65e89d8a84b6eb68738d4a16152 0.0s
=> CACHED [linux/arm64 1/2] FROM docker.io/library/amazonlinux@sha256:ed6a24ee79bb52f2308a20fb20e48b73cfa0b65e89d8a84b6eb68738d4a16152 0.0s
=> => resolve docker.io/library/amazonlinux@sha256:ed6a24ee79bb52f2308a20fb20e48b73cfa0b65e89d8a84b6eb68738d4a16152 0.0s
=> CANCELED [linux/amd64 2/2] RUN yum -y update 0.6s
=> ERROR [linux/arm64 2/2] RUN yum -y update 0.5s
------
> [linux/arm64 2/2] RUN yum -y update:
#8 0.370 /usr/bin/python: can't open file 'yum': [Errno 2] No such file or directory
------
Dockerfile:3
--------------------
1 | FROM amazonlinux
2 |
3 | >>> RUN yum -y update
4 |
5 |
--------------------
error: failed to solve: rpc error: code = Unknown desc = executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c yum -y update]: exit code: 2
but when I run it for just arm64 it works:
[vagrant@vagrant temp]$ docker buildx build --pull --no-cache --platform linux/arm64 -t motus/testbuild .
WARN[0000] No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 12.6s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 31B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/amazonlinux:latest 0.3s
=> CACHED [1/2] FROM docker.io/library/amazonlinux@sha256:ed6a24ee79bb52f2308a20fb20e48b73cfa0b65e89d8a84b6eb68738d4a16152 0.0s
=> => resolve docker.io/library/amazonlinux@sha256:ed6a24ee79bb52f2308a20fb20e48b73cfa0b65e89d8a84b6eb68738d4a16152 0.0s
=> [2/2] RUN yum -y update 12.2s
Any thoughts on this? I have the qemu aarch64 emulator installed.
Here's my docker info:
[vagrant@vagrant temp]$ docker system info
Client:
Debug Mode: false
Plugins:
buildx: Build with BuildKit (Docker Inc., v0.5.1)
Server:
Containers: 63
Running: 1
Paused: 0
Stopped: 62
Images: 148
Server Version: 19.03.13-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: c623d1b36f09f8ef6536a057bd658b3aa8632828
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0 (expected: fec3683)
Security Options:
seccomp
Profile: default
Kernel Version: 4.14.214-160.339.amzn2.x86_64
Operating System: Amazon Linux 2
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 22.98GiB
Name: vagrant
ID: MDVE:KCFM:HGLC:XUYO:OXRX:G4SG:Y74M:7GAM:QE3H:K364:YFYL:SH3X
Docker Root Dir: /vagrant-storage/docker
Debug Mode: false
Username: srankin
Registry: https://index.docker.io/v1/
Labels:
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Activity
tonistiigi commentedon Feb 13, 2021
That it is trying to use
/dev/.buildkit_qemu_emulatoris a sign that the emulator is not installed properly to be used by the containers. https://github.com/tonistiigi/binfmt/ for the recommended install method.No idea why it works on single run though, if it is the same configuration.
If you can't figure it out post output of
buildx inspect/lsandtonistiigi/binfmt.sdwr98 commentedon Feb 13, 2021
We do have QEMU installed via this method:
Here's the other info you requested:
tonistiigi commentedon Feb 13, 2021
If you look at the latest output then you have emulator called
qemu-aarch64installed but no support for runninglinux/arm64. So I assume this was installed with some other method and is not being picked up.Run
and see if it changes.
jlesage commentedon Feb 13, 2021
I'm also seeing the same issue with my GitHub workflow. The
docker/setup-qemu-actionaction is used to setup QEMU anddocker/setup-buildx-actionto setup buildx.As you mentioned,
qemu-aarch64is installed but no support for runninglinux/arm64:Here is the error that occurred during build of the images:
If you want to view the workflow: https://github.com/jlesage/docker-baseimage/runs/1895262162?check_suite_focus=true
tonistiigi commentedon Feb 14, 2021
@jlesage can you run
docker run --rm --privileged tonistiigi/binfmt:latestbefore trying to install emulators. I'd like to see what is already in the system. Other possibility is that the other emulators are colliding with thearm64binfmt mask real emulator does not get called. There was a new release ofbinfmtimage this week, that updated to qemu 5.2 and added mips. I checked the mask for mips and it looks ok to me and image seems to work well for me. If you want another test point you can try removing mips from the--installand see if it makes any difference.jlesage commentedon Feb 14, 2021
I did the requested tests locally on my machine, since I seem to have the same issue. I first clear all emulators from the system. So from a clean state:
Then, installing all emulators:
I also tried to remove mips64 from the emulators to install (again, starting from a fresh state):
Installing only
arm64is not better:jlesage commentedon Feb 14, 2021
On Github workflow, before install QEMU emulators:
jlesage commentedon Feb 14, 2021
In the following run: https://github.com/jlesage/docker-baseimage/runs/1896128490?check_suite_focus=true
arm64is now shown as supported:But build fails with same error:
tonistiigi commentedon Feb 14, 2021
I pushed
tonistiigi/binfmt:qemu-v5.1.0tonistiigi/binfmt:qemu-v5.0.1for testing.Also, what output do you get from
docker run --rm arm64v8/alpine uname -atonistiigi commentedon Feb 14, 2021
Btw the
/dev/.buildkit_qemu_emulatoritself should be fixed inmoby/buildkit:masterimage(even without binfmt) with moby/buildkit#1953 but if there is a regression in external emulators, we need to trace that down as well.jlesage commentedon Feb 14, 2021
Strange thing,
arm64finally appears as supported, but it takes some time. Here, you see that it took almost a minute:In all cases,
docker run --rm arm64v8/alpine uname -areturns:jlesage commentedon Feb 14, 2021
tonistiigi/binfmt:qemu-v5.1.0seems to have the same behaviour:However,
tonistiigi/binfmt:qemu-v5.0.1looks better, sincearm64is shown as supported right after install:jlesage commentedon Feb 14, 2021
Using
tonistiigi/binfmt:qemu-v5.0.1in the workflow looks better. However, one job failed with the following error. Maybe it's not related to the current issue ?https://github.com/jlesage/docker-baseimage/runs/1896254442?check_suite_focus=true
sdwr98 commentedon Feb 14, 2021
Is it normal for multiple runs of
tonistiigi/binfmtto return different results each time? I wonder if that has something to do with the intermittent nature of my build failing.tonistiigi commentedon Feb 14, 2021
No. When this happens does
docker run --rm arm64v8/alpine uname -awork consistently? This should show is flakiness is in running the emulator or in the "supported" check.Please post the full system information where you see this. Kernel, distro etc. Is there a way I can access such a machine? I know some reports seem to be in github actions(not sure about kernel etc there as well) but if it is flaky, it is hard to debug/bisect there.
It looks like @jlesage is reporting that 5.0.1 is ok while @sdwr98 has (sometimes) issue with that image as well. @sdwr98 Can you confirm this also worked for you before this week when we made a new release? Or did you just start using it.
88 remaining items
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542
(cherry-pick) Fix flaky arm64 emulator issue docker/buildx#542