Skip to content
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

multi-platform #448

Merged
merged 1 commit into from
Oct 25, 2021
Merged

multi-platform #448

merged 1 commit into from
Oct 25, 2021

Conversation

AkihiroSuda
Copy link
Member

@AkihiroSuda AkihiroSuda commented Oct 20, 2021

  • image convert (not new in this commit)
  • image inspect
  • rmi
  • pull
  • push
  • load
  • save
  • run
  • commit
  • build
  • compose
  • docs
  • tests

Multi-platform

nerdctl can execute non-native container images using QEMU.
e.g., ARM on Intel, and vice versa.

Preparation: Register QEMU to /proc/sys/fs/binfmt_misc

$ sudo nerdctl run --privileged --rm tonistiigi/binfmt --install all

$ ls -1 /proc/sys/fs/binfmt_misc/qemu*
/proc/sys/fs/binfmt_misc/qemu-aarch64
/proc/sys/fs/binfmt_misc/qemu-arm
/proc/sys/fs/binfmt_misc/qemu-mips64
/proc/sys/fs/binfmt_misc/qemu-mips64el
/proc/sys/fs/binfmt_misc/qemu-ppc64le
/proc/sys/fs/binfmt_misc/qemu-riscv64
/proc/sys/fs/binfmt_misc/qemu-s390x

The tonistiigi/binfmt container must be executed with --privileged.

See also https://github.com/tonistiigi/binfmt

Usage

Pull & Run

$ nerdctl pull --platform=arm64,s390x alpine

$ nerdctl run --rm --platform=arm64 alpine uname -a
Linux e6227935cf12 5.13.0-19-generic #19-Ubuntu SMP Thu Oct 7 21:58:00 UTC 2021 aarch64 Linux

$ nerdctl run --rm --platform=s390x alpine uname -a
Linux b39da08fbdbf 5.13.0-19-generic #19-Ubuntu SMP Thu Oct 7 21:58:00 UTC 2021 s390x Linux

Build & Push

$ nerdctl build --platform=amd64,arm64 --output type=image,name=example.com/foo:latest,push=true .

Or

$ nerdctl build --platform=amd64,arm64 -t example.com/foo:latest .
$ nerdctl push --all-platforms example.com/foo:latest

Compose

See examples/compose-multi-platform


Fix #103
Fix #280

@AkihiroSuda AkihiroSuda added this to the v0.13.0 milestone Oct 20, 2021
@AkihiroSuda AkihiroSuda force-pushed the multiplat branch 6 times, most recently from 306d4f9 to 738cefe Compare October 22, 2021 10:03
@AkihiroSuda AkihiroSuda changed the title [WIP] multi-platform multi-platform Oct 22, 2021
@AkihiroSuda AkihiroSuda marked this pull request as ready for review October 22, 2021 10:03
@AkihiroSuda AkihiroSuda force-pushed the multiplat branch 4 times, most recently from 137e409 to 7fbed71 Compare October 22, 2021 10:23
pkg/imgutil/pull/pull.go Outdated Show resolved Hide resolved
cmd/nerdctl/push.go Outdated Show resolved Hide resolved
cmd/nerdctl/push.go Outdated Show resolved Hide resolved
See `docs/multi-platform.md`

- [X] image convert (not new in new this commit)
- [X] image inspect
- [X] rmi
- [X] pull
- [X] push
- [X] load
- [X] save
- [X] run
- [X] commit
- [X] build
- [X] compose
- [X] docs
- [X] tests

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda AkihiroSuda merged commit 115c3c8 into containerd:master Oct 25, 2021
This was referenced Oct 25, 2021
@arpitjindal97
Copy link

Will it also work when running inside lima on MacOS ?

@AkihiroSuda
Copy link
Member Author

Yes, of course.
Will be probably included in Lima v0.7.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What is required to support --platform Support multi-arch images
3 participants