This project aims to make cross-compilation, and running programs and images built for a different CPU architecture simple.
Currently, the only host architecture supported is amd64 (AKA x86_64), while the architectures that can be emulated are:
i386(AKAx86,i686)arm(AKAarm32v7)aarch64(AKAarm64v8,arm64)riscv32riscv64
There are 3 distinct categories of images below:
- An image containing binaries for all architectures. Tagged with a version alone, ex:
:v5.1.0, or:latest. - An enable-emulation-only image. It contains no
qemubinaries, but can be used to enable emulation for use with your ownqemubinary. Tagged with the keywordenable, ex::v5.1.0-enable, or:enable. - A single-architecture image. These images contain a single architecture plus a script to enable emulation. Tagged with the name of the architecture, ex:
v5.1.0-arm, oraarch64.
For a complete list of available tags see: r/meedamian/simple-qemu/tags
v5.1.0,v5.1,v5,latestv5.1.0-arm,v5.1-arm,v5-arm,arm(or:arm32v7)v5.1.0-aarch64,v5.1-aarch64,v5-aarch64,aarch64(or:arm64v8&arm64)v5.1.0-riscv32,v5.1-riscv32,v5-riscv32,riscv32v5.1.0-riscv64,v5.1-riscv64,v5-riscv64,riscv64v5.1.0-enable,v5.1-enable,v5-enable,enable
v5.0.1,v5.0v5.0.1-arm,v5.0-arm(or:-arm32v7)v5.0.1-aarch64,v5.0-aarch64(or:-arm64v8&-arm64)v5.0.1-riscv32,v5.0-riscv32v5.0.1-riscv64,v5.0-riscv64v5.0.1-enable,v5.0-enable
v4.2.1,v4.2,v4v4.2.1-arm,v4.2-arm,v4-arm(or:-arm32v7)v4.2.1-aarch64,v4.2-aarch64,v4-aarch64(or:-arm64v8&-arm64)v4.2.1-riscv32,v4.2-riscv32,v4-riscv32v4.2.1-riscv64,v4.2-riscv64,v4-riscv64v4.2.1-enable,v4.2-enable,v4-enable
v4.1.1,v4.1v4.1.1-arm,v4.1-arm(or:-arm32v7)v4.1.1-aarch64,v4.1-aarch64(or:-arm64v8&-arm64)v4.1.1-riscv32,v4.1-riscv32v4.1.1-riscv64,v4.1-riscv64v4.1.1-enable,v4.1-enable
v4.0.1,v4.0v4.0.1-arm,v4.0-arm(or:-arm32v7)v4.0.1-aarch64,v4.0-aarch64(or:-arm64v8&-arm64)v4.0.1-riscv32,v4.0-riscv32v4.0.1-riscv64,v4.0-riscv64v4.0.1-enable,v4.0-enable
v3.1.1,v3.1,v3v3.1.1-arm,v3.1-arm,v3-arm(or:-arm32v7)v3.1.1-aarch64,v3.1-aarch64,v3-aarch64(or:-arm64v8&-arm64)v3.1.1-riscv32,v3.1-riscv32,v3-riscv32v3.1.1-riscv64,v3.1-riscv64,v3-riscv64v3.1.1-enable,v3.1-enable,v3-enable
Older versions here
v5.0.0v5.0.0-arm(or:-arm32v7)v5.0.0-aarch64(or:-arm64v8&-arm64)v5.0.0-riscv32v5.0.0-riscv64v5.0.0-enable
v4.2.0v4.2.0-arm(or:-arm32v7)v4.2.0-aarch64(or:-arm64v8&-arm64)v4.2.0-riscv32v4.2.0-riscv64v4.2.0-enable
v4.1.0v4.1.0-arm(or:-arm32v7)v4.1.0-aarch64(or:-arm64v8&-arm64)v4.1.0-riscv32v4.1.0-riscv64v4.1.0-enable
v4.0.0v4.0.0-arm(or:-arm32v7)v4.0.0-aarch64(or:-arm64v8&-arm64)v4.0.0-riscv32v4.0.0-riscv64v4.0.0-enable
v3.1.0v3.1.0-arm(or:-arm32v7)v3.1.0-aarch64(or:-arm64v8&-arm64)v3.1.0-riscv32v3.1.0-riscv64v3.1.0-enable
First, enabling emulation needs to be coordinated with host's kernel:
docker run --rm --privileged meedamian/simple-qemu -p yesOnce that's done, two things become possible:
To run image built for a different CPU architecture:
docker run --rm arm32v7/alpine uname -mAlternatively (buildx style):
docker run --rm --platform=linux/arm/v7 alpine uname -mTo build FROM different CPU architecture image:
FROM arm32v7/alpine
# Everything written here will be run on an emulated architectureAlternatively (buildx style):
FROM --platform=linux/arm/v7 alpine
# Everything written here will be run on an emulated architectureIt's that simple :).
Note: To learn what architectures are available for the given base image you can use
docker manifest inspectcommand, for example:$ docker manifest inspect alpine | jq -r '.manifests[].platform | .os + "/" + .architecture + "/" + .variant' linux/amd64 linux/arm/v6 linux/arm/v7 linux/arm64/v8 linux/386 linux/ppc64le linux/s390x
Depending on qemu version used, the speed of emulation can vary from hardly bearable all the way to nightmarishly slow.
For daily generated speed comparisons see: lncm/docker-bitcoind#9
If you discover a bug please report it here. Express gratitude here.
Mail me at bugs@meedamian.com, or on twitter @meeDamian.
MIT @ Damian Mee