Docker Image for M1 Mac

I recently updated to a new M1 MacBook, and was wondering if a ready-made docker image exists? Especially one that works with PyROOT (and is at least compatible with Jupyter). I know there are ROOT installation methods for Mac which should work, but I was hoping to containerize my software on this new machine to avoid some frustrations I’ve had in the past.

It appears the ROOT docker images don’t have an arm-compatible build (although I didn’t test exhaustively).

I then attempted to create my own docker build based on Debian to match the Linux flow I use. This promptly led to several other issues:

  • All the pre-compiled Linux binaries are x86 and not arm* (hasn’t anyone put ROOT on a Raspbian RPi?)
  • Debian doesn’t have a supported package-supported ROOT version (it would probably be obsolete anyway)
  • snap is weird in a container and wasn’t readily working
  • I haven’t actually conda, old prejudice

So I tried to build from source using 6.24.02. Unsurprisingly that broke somewhere (I was building on two cores, so unsure what’s interleaved):

Scanning dependencies of target obj.clangASTMatchers
[ 71%] Building CXX object interpreter/llvm/src/tools/clang/lib/ASTMatchers/CMakeFiles/obj.clangASTMatchers.dir/ASTMatchFinder.cpp.o
{standard input}: Assembler messages:
{standard input}:86932: Error: 64-bit integer or SP register expected at operand 2 – `ldrb w0,[s’ {standard input}: Error: open CFI at the end of file; missing .cfi_endproc directive **c++:** **fatal error:** Killed signal terminated program cc1plus compilation terminated. make[2]: *** [interpreter/llvm/src/tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/build.make:128: interpreter/llvm/src/tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ASTImporter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:13980: interpreter/llvm/src/tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…
[ 71%] Building CXX object interpreter/llvm/src/tools/clang/lib/ASTMatchers/CMakeFiles/obj.clangASTMatchers.dir/ASTMatchersInternal.cpp.o
[ 71%] Built target obj.clangASTMatchers
make: *** [Makefile:152: all] Error 2


see GitHub - root-project/root-docker: Docker recipes for ROOT and, for Jupyter notebooks, an example at GitHub - root-project/docker-examples: Examples for using the ROOT Docker container. .

Let us know if that helps!

Checking the Ubuntu recipe, it uses the binary, which fails because it relies on the x86 architecture. I guess the other linux flavors circumvent this by having support for root through their package managers? Maybe I’m out of luck for my flavor of choice?

Uhm let’s take a step back, do you just need to install ROOT on your M1 macbook? In that case you should be able to either compile from scratch or use the homebrew or conda packages.

I was explicitly trying to get a containerized ROOT installation for my Mac - I know that brew/conda allow for a native installation, and I had done this on my last laptop. But dependencies for other software got to be a mess (and it was a nuisance to recompile other inheriting software when Xcode updates) and so I wanted to containerize my various stacks, and ROOT sits near the base of those stacks.

I know this isn’t the most standard install case, but I was hoping I’m not alone in this niche.

The Docker documentation says it might be possible to try emulating the AMD64 releases in the same way MacOS does so for normal applications, though it comes with multiple caveats.

You can add --platform linux/amd64 to run an Intel image under emulation.

Regarding the snap specific bit of the post, it’s possible to get snapd to work in Docker but I’m not exactly sure of the requirements, but I’d very much encourage using a proper virtual machine in that instance anyway (At a first glance it looks like M1 Macs might be short of options for a while as the ecosystem adapts to the changes). Additionally, I don’t currently publish ARM64 builds via snap, though I’ve put one in the build queue as an experiment. Ultimately though, it’s an opinionated package that comes with its own caveats, so depending on your requirements from ROOT you might be best served with another option for the time being anyway.

I understand! A dedicated conda environment might satisfy your requirement of isolating ROOT and the software that sits on top of it from the rest, but if “the rest” is not packaged with conda it might be annoying.

For Docker on Apple M1: looking at the Docker docs that @James-Carroll shared, you should be able to start from a ARM64 or multi-arch image and compile ROOT in there (ROOT compiles on ARM and it can be installed on Raspberry Pi’s, for instance – there are some forum posts about some tweaks that might have to be applied).


ROOT 6.24/02 builds on M1 out of the box - so if building from source is really the option you need (because of a specific Python dependency) then I’d just try that!