Repository navigation
Description
Description
Inside nerdctl container image, wanted to build or run container image having different arch.
Steps to reproduce the issue
- Run nerdctl in the container using the official image at ghcr.io/containerd/nerdctl:master by
docker run --rm --privileged -it ghcr.io/containerd/nerdctl:master - Try to run an "arm64 based ubuntu image" by
nerdctl run --rm -it arm64v8/ubuntu uname -mthe
Describe the results you received and expected
Above operation to run image failed with below log
root@fc84829df24d:/# nerdctl run --rm -it arm64v8/ubuntu uname -m
docker.io/arm64v8/ubuntu:latest: resolved |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:6f266288ee3e1fce297f66073c06a33fb0f3a6829081d3a1ccb4d70ab6804f6b: done |++++++++++++++++++++++++++++++++++++++|
config-sha256:bad148f8963fb9be6c8c260ce8a65aadd1cdfdd95e5bd16867d0f987cd7ebff3: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:4a3049d340b7d3651a954fd25a32c42feb1086889d6287e2f15468aef865c5c4: done |++++++++++++++++++++++++++++++++++++++|
elapsed: 2.8 s total: 27.1 M (9.6 MiB/s)
exec /usr/bin/uname: exec format error
But it should got successful and completed with printing "aarch64" as below
root@c2720604c721:/# nerdctl run --rm -it arm64v8/ubuntu uname -m
docker.io/arm64v8/ubuntu:latest: resolved |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:6f266288ee3e1fce297f66073c06a33fb0f3a6829081d3a1ccb4d70ab6804f6b: done |++++++++++++++++++++++++++++++++++++++|
config-sha256:bad148f8963fb9be6c8c260ce8a65aadd1cdfdd95e5bd16867d0f987cd7ebff3: done |++++++++++++++++++++++++++++++++++++++|
layer-sha256:4a3049d340b7d3651a954fd25a32c42feb1086889d6287e2f15468aef865c5c4: done |++++++++++++++++++++++++++++++++++++++|
elapsed: 2.3 s total: 27.1 M (11.8 MiB/s)
aarch64
What version of nerdctl are you using?
root@fc84829df24d:/# nerdctl version
Client:
Version: af6ac29
OS/Arch: linux/amd64
Git commit: af6ac29
buildctl:
Version: v0.10.3
GitCommit: c8d25d9a103b70dc300a4fd55e7e576472284e31
Server:
containerd:
Version: v1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.3
GitCommit: v1.1.3-0-g6724737f
root@fc84829df24d:/#
Are you using a variant of nerdctl? (e.g., Rancher Desktop)
No response
Host information
root@fc84829df24d:/# nerdctl info
Client:
Namespace: default
Debug Mode: false
Server:
Server Version: v1.6.8
Storage Driver: overlayfs
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Log: fluentd journald json-file
Storage: native overlayfs stargz
Security Options:
apparmor
seccomp
Profile: default
cgroupns
Kernel Version: 5.15.0-1011-aws
Operating System: Ubuntu 22.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 967.9MiB
Name: fc84829df24d
ID: 401820f6-02be-4f43-b594-16e6470a85e5
root@fc84829df24d:/#
Activity
rajpratik71 commentedon Aug 17, 2022
Further, arm based image build is also failing
root@fc84829df24d:/#
root@fc84829df24d:/# nerdctl build -t arm64-test-image --platform=arm64 -f Dockerfile .
[+] Building 3.0s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 105B 0.0s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/arm64v8/ubuntu:latest 0.5s
=> [1/2] FROM docker.io/arm64v8/ubuntu:latest@sha256:6f266288ee3e1fce297f66073c06a33fb0f3a6829081d3a1ccb4d70ab6804f6b 2.1s
=> => resolve docker.io/arm64v8/ubuntu:latest@sha256:6f266288ee3e1fce297f66073c06a33fb0f3a6829081d3a1ccb4d70ab6804f6b 0.0s
=> => sha256:4a3049d340b7d3651a954fd25a32c42feb1086889d6287e2f15468aef865c5c4 28.38MB / 28.38MB 0.4s
=> => extracting sha256:4a3049d340b7d3651a954fd25a32c42feb1086889d6287e2f15468aef865c5c4 1.6s
=> ERROR [2/2] RUN apt update -y && apt install -y nano 0.3s
Dockerfile:2
1 | FROM arm64v8/ubuntu:latest
2 | >>> RUN apt update -y && apt install -y nano
3 |
error: failed to solve: process "/bin/sh -c apt update -y && apt install -y nano" did not complete successfully: exit code: 1
FATA[0003] unrecognized image format
root@fc84829df24d:/#
root@fc84829df24d:/# cat Dockerfile
FROM arm64v8/ubuntu:latest
RUN apt update -y && apt install -y nano
root@fc84829df24d:/#
root@fc84829df24d:/#
feat : fixes containerd#1321 Multi arch image build and run support i…
[-]Multi arch image build support in nerdctl container image[/-][+][Dockerfile] Multi arch image build support in nerdctl container image[/+]AkihiroSuda commentedon Aug 17, 2022
See https://github.com/containerd/nerdctl/blob/master/docs/multi-platform.md#preparation-register-qemu-to-procsysfsbinfmt_misc