Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dockerfile] Multi arch image build support in nerdctl container image #1321

Closed
Rajpratik71 opened this issue Aug 17, 2022 · 2 comments
Closed
Labels
question Further information is requested

Comments

@Rajpratik71
Copy link
Contributor

Description

Inside nerdctl container image, wanted to build or run container image having different arch.

Steps to reproduce the issue

  1. 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
  2. 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:/#

@Rajpratik71 Rajpratik71 added the kind/unconfirmed-bug-claim Unconfirmed bug claim label Aug 17, 2022
@Rajpratik71
Copy link
Contributor Author

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

[2/2] RUN apt update -y && apt install -y nano:
#0 0.110 exec /bin/sh: exec format error


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:/#

Rajpratik71 added a commit to Container-Projects/nerdctl that referenced this issue Aug 17, 2022
…n nerdctl container

fixes containerd#1321 

Installing required qemu based packages for emulating different arch in container for Multi arch image build and run support in nerdctl container image

Signed-off-by: Pratik Raj <[email protected]>
@AkihiroSuda AkihiroSuda changed the title Multi arch image build support in nerdctl container image [Dockerfile] Multi arch image build support in nerdctl container image Aug 17, 2022
@AkihiroSuda AkihiroSuda added question Further information is requested and removed kind/unconfirmed-bug-claim Unconfirmed bug claim labels Aug 17, 2022
@AkihiroSuda
Copy link
Member

@containerd containerd locked and limited conversation to collaborators Aug 17, 2022
@AkihiroSuda AkihiroSuda converted this issue into discussion #1323 Aug 17, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
2 participants