Open mgiessing opened 1 year ago
I got a problem when running --platform linux/amd64 builds on an IBM Power (ppc64le) host. ARM64 doesn't seem to have this problem when emulated.
--platform linux/amd64
Installed docker:
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo dnf install docker-ce docker-ce-cli -y
Installed buildx:
wget https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-ppc64le-O ~/.docker/cli-plugins/docker-buildx chmod +x ~/.docker/cli-plugins/docker-buildx
Install binfmt
docker run --rm --privileged tonistiigi/binfmt:latest --install all docker buildx create --name mybuilder --use --bootstrap
Check environment
$ uname -m ppc64le
$ docker --version Docker version v20.10.21, build baeda1f
$ docker buildx version github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689
$ docker buildx ls NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS mybuilder * docker-container mybuilder0 unix:///var/run/docker.sock running v0.10.5 linux/ppc64le, linux/amd64, linux/amd64/v2, linux/arm64, linux/riscv64, linux/s390x, linux/mips64le, linux/mips64 default docker default default running v20.10.21 linux/ppc64le, linux/amd64, linux/arm64, linux/riscv64, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
## Simple dockerfile to reproduce ```dockerfile FROM almalinux:8.6 RUN dnf update -y && dnf install vim -y
When I build for ppc64le and arm64 using these commands it works:
docker buildx build --load --platform linux/ppc64le -t test-alma:ppc64le -f Dockerfile.alma . docker buildx build --load --platform linux/arm64 -t test-alma:arm64 -f Dockerfile.alma .
However when I want to build for x86/amd64 using this command:
docker buildx build --load --platform linux/amd64 -t test-alma:amd64 -f Dockerfile.alma .
I'm getting this error:
[...] > [2/2] RUN dnf update -y && dnf install vim -y: #0 2.191 Traceback (most recent call last): #0 2.191 File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 14, in swig_import_helper #0 2.191 return importlib.import_module(mname) #0 2.191 File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module #0 2.191 return _bootstrap._gcd_import(name[level:], package, level) #0 2.191 File "<frozen importlib._bootstrap>", line 994, in _gcd_import #0 2.191 File "<frozen importlib._bootstrap>", line 971, in _find_and_load #0 2.191 File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked #0 2.191 File "<frozen importlib._bootstrap>", line 658, in _load_unlocked #0 2.191 File "<frozen importlib._bootstrap>", line 571, in module_from_spec #0 2.191 File "<frozen importlib._bootstrap_external>", line 922, in create_module #0 2.191 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed #0 2.191 ImportError: libgmp.so.10: ELF load command alignment not page-aligned #0 2.191 #0 2.191 During handling of the above exception, another exception occurred: #0 2.191 #0 2.191 Traceback (most recent call last): #0 2.191 File "/usr/bin/dnf", line 57, in <module> #0 2.191 from dnf.cli import main #0 2.191 File "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 30, in <module> #0 2.191 import dnf.base #0 2.191 File "/usr/lib/python3.6/site-packages/dnf/base.py", line 29, in <module> #0 2.191 import libdnf.transaction #0 2.191 File "/usr/lib64/python3.6/site-packages/libdnf/__init__.py", line 8, in <module> #0 2.191 from . import error #0 2.191 File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 17, in <module> #0 2.191 _error = swig_import_helper() #0 2.191 File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 16, in swig_import_helper #0 2.191 return importlib.import_module('_error') #0 2.191 File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module #0 2.191 return _bootstrap._gcd_import(name[level:], package, level) #0 2.191 ModuleNotFoundError: No module named '_error' ------ Dockerfile.alma:2 -------------------- 1 | FROM almalinux:8.6 2 | >>> RUN dnf update -y && dnf install vim -y 3 | 4 | -------------------- ERROR: failed to solve: process "/bin/sh -c dnf update -y && dnf install vim -y" did not complete successfully: exit code: 1
Running a simple container with --platform linux/amd64 seems to work:
$ docker run -ti --platform linux/amd64 almalinux:8.6 uname -m x86_64
Any idea how to fix this issue? Is this related to binfmt or to AlmaLinux?
Thanks!
Just for consistency: I tried the same procedure on an x86_64 host and there everything works just fine, i.e. I can build amd64/ppc64le/arm64 without issues.
I got a problem when running
--platform linux/amd64
builds on an IBM Power (ppc64le) host. ARM64 doesn't seem to have this problem when emulated.First my the setup:
Installed docker:
Installed buildx:
Install binfmt
Check environment
$ docker --version Docker version v20.10.21, build baeda1f
$ docker buildx version github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689
$ docker buildx ls NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS mybuilder * docker-container
mybuilder0 unix:///var/run/docker.sock running v0.10.5 linux/ppc64le, linux/amd64, linux/amd64/v2, linux/arm64, linux/riscv64, linux/s390x, linux/mips64le, linux/mips64 default docker
default default running v20.10.21 linux/ppc64le, linux/amd64, linux/arm64, linux/riscv64, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
The error
When I build for ppc64le and arm64 using these commands it works:
However when I want to build for x86/amd64 using this command:
I'm getting this error:
Running a simple container with
--platform linux/amd64
seems to work:Any idea how to fix this issue? Is this related to binfmt or to AlmaLinux?
Thanks!