Building Linux packages for different CPU architectures with Docker and QEMU

Building

The process of building your software consists of two main steps:

1) register QEMU/binfmt

If you try to run a Docker container that is built for a different CPU architecture than the host’s it will fail with this error:

2) Build your software

All we need to do now is to run the usual build steps (e.g. ./configure, make, make test, etc.) inside the foreign Docker container.

In action

You can see all this in action at Varnish Cache GitHub repository.

Conclusion

Using stable tools like Docker and QEMU makes it easier to build and test our software for different CPU architectures.

 by the author.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store