Run an ARM32 Docker daemon on ARM64 servers
In the last days I worked on a suitable setup for a Drone CI server to support multi-arch builds. While the setup for common x86 Drone runners is easy, working with setups for ARM, especially ARM32, is a bit tricky. The easiest way would be to have native servers of the respective architecture available. However, it’s difficult to find hosting offers for ARM at all - for ARM32 this seems almost impossible. I decided to use Amazon EC2 ARM64 servers, they are relatively cheap and can also be used as a private customer.
But how do you turn an ARM64 server into an ARM32 server? Basic requirement is an ARMv8 CPU. This type supports (in most cases) both AArch32
and AArch64
. The first step is to enable multi-arch support on your operating system. I use Ubuntu 18.10 for this setup:
dpkg --add-architecture armhf
Then add the Docker CE repository for ARM32 and install the packages:
|
|
To use the right architecture within Docker containers you still have to force the Docker daemon into ARM32 mode. This can be accomplished by two systemd overwrites:
|
|
That’s it. Don’t forget to reload and restart the systemd daemon:
systemctl, daemon reload
systemctl, restart, docker
What you get is a Docker daemon that runs in ARM32 mode. This can be used for example to start a Golang container and build apps without cross-compile.
|
|
Just a word of warning. I’m not a hardware specialist and there might be some situations where this setup does not work. Furthermore it seems that some operating systems have problems to recognize armv8l
as ARM32 architecture. For OpenSuse as an example I had to force zypper
into armv7hl
mode to get it working. After this step building ARM32 OpenSuse Docker images also works for me.
sed -i 's/# arch = s390/arch = armv7hl/g' /etc/zypp/zypp.conf
If you want to give it a try, I’ve prepared a minimal Cloud-Init configuration:
|
|