Cross Platform Docker Builds… Or not…

One of the things I’ve started trying really hard to do for our Docker builds is to try to create cross-platfrom images that run on arm64 and arm32 devices as well as amd64. This means they should run on new Mac M1s as well as Raspberry Pis running 32 and 64 bit o/s.

I thought I had a stack today working most of the way with an official Python base container (Debian, but the TM351 Data Managament and Analysis fell at the last hurdle on arm64 because arm64/Debian is not supported by Mongo, (Mongo is generally the thing that f**ks with me every time I try to update the image). The arm32 build had actually fallen a bit before that with the build I wanted to do because it needs a very old version of proj4.

Switching to an ubuntu base container also caused issues. SOmeof the packages between ubuntu and Debian are at different versions (Postgres 12 vs 11, libblis3-serial vs libblis2-serial) and on RPi Python fails with a “pyinit_main: can’t initialize time” error that seems to require running the container in privileged mode as a fix.

It’s way too late, and I’m way too tired (3am is just a minute away) to try the fixing the buildstack again, so I figure: make these notes of what I think we the main diffs between Debian and ubuntu, and go back to the ubuntu build. If students want to run arm64 at home I can give them a docker-compose setup (which was my preference anyway: the monolithic container is primarily to suit the single container needs of a hosted Jupyter solution) with Mongo running in its own container.

Hmm… this suggests that I should make a docker compose script the primary instruction route for student setup… then all we need to do is ship them an appropriate docker-compose file and they donlt need to know how many containers are running…

The downside, of course, is that the docker-compose route requires a file download, whereas the docker run route can just be typed. (I’m still waiting on Docker Dashboard to let you pull an image… And I haven’t had a chance to try to simplify portainer to make that the defaust home user UI.)

So, four past 3… a.m. eternal…

And just gone 10 past eternal, another gotcha – in ubuntum where I need to manually install the is-it-really-still-that-recent Python 3.9, I need to manually link the python command:

RUN curl -o && \

RUN ln -s /usr/bin/python3.9 /usr/bin/python

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

%d bloggers like this: