github.com/containerd/nerdctl@v1.7.7/docs/multi-platform.md (about)

     1  # Multi-platform
     2  
     3  | :zap: Requirement | nerdctl >= 0.13 |
     4  |-------------------|-----------------|
     5  
     6  nerdctl can execute non-native container images using QEMU.
     7  e.g., ARM on Intel, and vice versa.
     8  
     9  ## Preparation: Register QEMU to `/proc/sys/fs/binfmt_misc`
    10  
    11  ```console
    12  $ sudo systemctl start containerd
    13  
    14  $ sudo nerdctl run --privileged --rm tonistiigi/binfmt --install all
    15  
    16  $ ls -1 /proc/sys/fs/binfmt_misc/qemu*
    17  /proc/sys/fs/binfmt_misc/qemu-aarch64
    18  /proc/sys/fs/binfmt_misc/qemu-arm
    19  /proc/sys/fs/binfmt_misc/qemu-mips64
    20  /proc/sys/fs/binfmt_misc/qemu-mips64el
    21  /proc/sys/fs/binfmt_misc/qemu-ppc64le
    22  /proc/sys/fs/binfmt_misc/qemu-riscv64
    23  /proc/sys/fs/binfmt_misc/qemu-s390x
    24  ```
    25  
    26  The `tonistiigi/binfmt` container must be executed with `--privileged`, and with rootful mode (`sudo`).
    27  
    28  This container is not a daemon, and exits immediately after registering QEMU to `/proc/sys/fs/binfmt_misc`.
    29  Run `ls -1 /proc/sys/fs/binfmt_misc/qemu*` to confirm registration.
    30  
    31  See also https://github.com/tonistiigi/binfmt
    32  
    33  ## Usage
    34  ### Pull & Run
    35  
    36  ```console
    37  $ nerdctl pull --platform=arm64,s390x alpine
    38  
    39  $ nerdctl run --rm --platform=arm64 alpine uname -a
    40  Linux e6227935cf12 5.13.0-19-generic #19-Ubuntu SMP Thu Oct 7 21:58:00 UTC 2021 aarch64 Linux
    41  
    42  $ nerdctl run --rm --platform=s390x alpine uname -a
    43  Linux b39da08fbdbf 5.13.0-19-generic #19-Ubuntu SMP Thu Oct 7 21:58:00 UTC 2021 s390x Linux
    44  ```
    45  
    46  ### Build & Push
    47  ```console
    48  $ nerdctl build --platform=amd64,arm64 --output type=image,name=example.com/foo:latest,push=true .
    49  ```
    50  
    51  Or
    52  
    53  ```console
    54  $ nerdctl build --platform=amd64,arm64 -t example.com/foo:latest .
    55  $ nerdctl push --all-platforms example.com/foo:latest
    56  ```
    57  
    58  ### Compose
    59  See [`../examples/compose-multi-platform`](../examples/compose-multi-platform)