Error running docker build for arm32v7 container on amd64 linux machine: standard_init_linux.go:207

假如想象 提交于 2021-01-29 05:32:02

问题


I have an amd64 linux machine that I'm using to build an arm32v7 container. When docker build encounters the first RUN command, it errors out with:

standard_init_linux.go:207: exec user process caused "no such file or directory"

This can be easily reproduced without a docker file by running docker run -it arm32v7/ubuntu:xenial on an amd64 linux host.

I've seen this complaint elsewhere, but most advice is that you need to build an arm32v7 container on an arm32v7 host. This is fairly impractical.

I've had success on Ubuntu 19.04 and 18.10 adding some architecture emulation:

sudo apt-get install -y qemu qemu-user-static qemu-user binfmt-support

After adding these packages, the error goes away and I can create my arm32v7 container.

But, this does NOT work for Ubuntu 18.04 or 16.04.

Is there a general solution that works everywhere?


回答1:


It seems that there are some post-install steps that are failing on Ubuntu 18.04 and 16.04.

Here are a couple workarounds that solve the problem on 18.04 and 16.04.

Method 1:

git clone https://github.com/computermouth/qemu-static-conf.git
sudo mkdir -p /lib/binfmt.d
sudo cp qemu-static-conf/*.conf /lib/binfmt.d
sudo systemctl restart systemd-binfmt.service

Method 2:

sudo mkdir -p /lib/binfmt.d
sudo sh -c 'echo :qemu-arm:M::\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xfe\\xff\\xff\\xff:/usr/bin/qemu-arm-static:F > /lib/binfmt.d/qemu-arm-static.conf'
sudo sh -c 'echo :qemu-aarch64:M::\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7\\x00:\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xfe\\xff\\xff\\xff:/usr/bin/qemu-aarch64-static:F > /lib/binfmt.d/qemu-aarch64-static.conf'
sudo systemctl restart systemd-binfmt.service


来源:https://stackoverflow.com/questions/56063608/error-running-docker-build-for-arm32v7-container-on-amd64-linux-machine-standar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!