4 Steps to build arm-based docker image on Mac OS

4 Steps to build arm-based docker image on Mac OS

To build an arm image, we need the qemu emulator to emulate those arm executions in the image. First, extract the static linked qemu emulator from linux.

To not mess with Mac, we do it in an Ubuntu Docker:

//On Ubuntu Docker

sudo apt install -y qemu qemu-user-static qemu-user binfmt-support

SCP the qemu-arm-static out from docker Ubuntu Docker machine to host Mac

//On Ubuntu Docker

scp qemu-arm-static scottie@10.0.0.257:~

Register QEMU as the build agent in Mac:

Don’t understand, but it works… //On Mac

docker run --rm --privileged multiarch/qemu-user-static:register --reset

Create the Dockerfile with ubuntu-arm from Mac:

//On Mac

FROM armv7/armhf-ubuntu:16.04
COPY qemu-arm /usr/bin/qemu-arm-static
RUN echo Hello from ARM container

ref:

  • https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/
  • https://resin.io/blog/building-arm-containers-on-any-x86-machine-even-dockerhub/
Scott Tse's Picture

About Scott Tse

Discover and Exploit.

Hong Kong, China https://wishlog.github.io

Comments