code-maat icon indicating copy to clipboard operation
code-maat copied to clipboard

Docker image fails to build on Apple Silicon (M1-ARM64 architecture)

Open wonderbird opened this issue 4 years ago • 6 comments

When you run

docker build -t code-maat-app .

on a Mac with Apple Silicon chip, then docker fails with the following error message

ERROR [internal] load metadata for docker.io/library/clojure:alpine
...
error: failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:d7bcb938ec3e6cef737e621e83f82b6ebbf6e60ebf5e4354c2f7d5418bb7cc5c: not found

I suspect that the base image clojure:alpine is not available for the linux/arm64 architecture at the time of writing.

I wouldn't change anything in code maat for now. Instead, let's use this thread to make users aware of the issue and present workarounds for the time being.

wonderbird avatar Jan 26 '22 04:01 wonderbird

As a very slow workaround, one could run

docker buildx build --platform linux/amd64 -t code-maat-app .

This would use the Rosetta 2 emulation.

On my machine the build process took extremely long (I aborted after about 12 minutes).

wonderbird avatar Jan 26 '22 04:01 wonderbird

I prefer the following workaround, which trades off container size against time behaviour:

  1. Change the FROM line in Dockerfile such, that the latest clojure image is used instead of the alpine version:

    FROM clojure:latest
    
  2. Build and use the docker container as usual

    docker build -t code-maat-app .
    docker run -v "$PWD":/data -it code-maat-app -l /data/hib_evo.log -c git -a authors
    

wonderbird avatar Jan 26 '22 04:01 wonderbird

I had exactly the same problem, and also reached the same workaround as you @wonderbird

Perhaps a fix for this will be to just make a note in the README to update from FROM clojure:alpine to FROM clojure:latest for apple silicon devices?

jinhongeasypark avatar Jun 15 '22 11:06 jinhongeasypark

I just used the clojure:latest workaround as well, still working fine in 2023 (and the original issue with the alpine image is still present upstream)

mkornblum avatar Sep 19 '23 22:09 mkornblum