The purpose of the image is to run arm/aarch64 docker image in x86-64 plaform. It also can be used in building arm/aarch64 image. I made an example yen3/docker-ubuntu-novnc. You can see the project to get more details.
If you use Docker in macOS, you have no need to use the docker image since the macOSX docker has hypervisor inside.
- docker with privileged access for binfmt_misc register.
-
Command memo
docker pull yen3/binfmt-register:latest
-
Command example (in Ubuntu 16.04). You can replace the first two lines with
export CPU=aarch64
andexport RUN_IMAGE=arm64v8/alpine
to test aarch64export CPU=arm export RUN_IMAGE=arm32v7/alpine # Register binfmt docker run --rm --privileged yen3/binfmt-register set ${cpu} # Get qemu static binary docker run --rm yen3/binfmt-register get ${cpu} > qemu-${cpu}-static chmod +x qemu-${cpu}-static # Run the image with the qemu static binary export MOUNT_QEMU="-v $(pwd)/qemu-${cpu}-static:/usr/local/bin/qemu-${cpu}-static" docker run -it --rm ${MOUNT_QEMU} ${RUN_IMAGE} uname -a # Unregister binfmt docker run --rm --privileged yen3/binfmt-register clear ${cpu} # Remove the qemu static binary rm -f qemu-${cpu}-static
test.sh
provides a simple example for running arm/aarch64 docker images in Linux and Darwin(macOS) platform- The makefile and dockerfiles in yen3/docker-ubuntu-novnc provide an example to build arm/aarch64 docker images in Linux/Darwin platform.
-
Build command:
docker build -t yen3/binfmt-register:latest
- The source of qemu static binary is from
qemu-*
package in alpine:edge. The version of qemu is 2.10.
- The source of qemu static binary is from
-
If you have any need to build qemu static binary from source. The example dockerfile is in
from_source/Dockerfile
. The build command isdocker build -t yen3/binfmt-register:latest -f from_source/Dockerfile