One of the promises of Docker is reproducibility: you can build an image on a different machine, and assuming you’ve done the appropriate setup, get the same result.
So it can be a little confusing when you try to build your Python-based Dockerfile on a new Mac, and everything starts failing.
What used to work before—on an older Mac, or on a Linux machine—fails in completely unexpected ways.
The problem is that the promise of reproducibility relies on certain invariants that don’t apply on newer Macs. The symptoms can be non-obvious, though, so in this article we’ll cover:
- Common symptoms of the problem when using Python.
- The cause of the problem: a different CPU instruction set.
- Solving the problem by ensuring the code is installable or compilable.
- Solving problem with CPU emulation, some of the downsides of this solution, and future improvements to look forward to.
- A takeaway for maintainers of open source Python packages.