question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Backend container fails to build on Apple Silicon Mac

See original GitHub issue

Describe the bug:

docker-compose build currently fails on Apple Silicon Macs. I haven’t been able to fully figure out why it breaks from the error logs, but a bit of research suggests that there are known compatibility issues when using Prisma in certain Docker images on Apple Silicon Macs.

I was able to get the project running by using the following server.Dockerfile (using the node:16 image and installing netcat)

FROM node:16

WORKDIR /usr/chapter/

# Bundle app source
COPY ./server ./server
COPY package*.json ./

# Install app dependencies
RUN apt-get update && apt-get -y dist-upgrade && apt install -y netcat 
RUN npm ci -w=server --ignore-scripts

EXPOSE 5000

WORKDIR /usr/chapter/server

CMD [ "npm","run","dev" ]

Just to be clear I’m not suggesting that this Dockerfile should be used, as it creates an unnecessarily large image - it’s just the first thing that I got to work. But I do think that making the project work out of the box on all common platforms should be a goal.

Tell us about your browser and operating system:

M1 MacBook Air, MacOS 12.2.1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
c-ehrlichcommented, May 16, 2022

@allella it should not make a difference for CPUs that are already amd64 (Intel CPUs are also amd64) - what the platform command actually does is tell Docker to download the image for the specified platform/architecture, so amd64 would use this image anyway. Emulation is how Apple Silicon (and Windows on ARM) deals with non-native images.

I worked on a different part of Chapter last night. Anecdotally the server feels indistinguishable from native, which makes sense as it doesn’t need to handle a lot of requests during dev/testing.

By the way Windows on ARM also has x64 emulation. Some of the Snapdragon SoCs are a bit slower than the M1, but they should still be able to emulate fine.

The only devices I’m not sure about is ARM-based Chromebooks or other ARM-based Linux machines. However the current containers already wouldn’t build on those so at least fixing it on Apple Silicon and Windows on ARM without impacting other platforms feels like a good improvement for the time being.

0reactions
allellacommented, May 16, 2022

@c-ehrlich is the emulation only going to slow down the Mac Silicon since most other processors will already be amd64? Or, does adding that emulation line also cause a typical x64 CPU to operate in a different mode?

If it’s only slowing down the new Macs, then it would seem that’s better than making everyone else slow by downloading 10x the images.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Docker engine in infinite startup loop on new Mac M1 #6142
Just recently received a new Apple M1. Docker was working for a few days and then stopped. I recently gave it more resources...
Read more >
Known issues for Docker Desktop on Mac
Docker does not auto-start on login even when it is enabled in Preferences. This is related to a set of issues with Docker...
Read more >
Why new Macs break your Docker build, and how to fix it
Solution #2: Run x86_64 Docker images instead​​ The other option is to run x86_64 Docker images on your ARM64 Mac machine, using emulation. ......
Read more >
Docker won't run on Big Sur | Apple Developer Forums
Docker 2.3.0.3 starts and is running on an iMac with Big Sur installed. ... is not working on my macOS Big Sur. Unable...
Read more >
Limitations on docker on Apple M1 (Apple Silicon)? - Reddit
I have a Macbook M1 and currently working on a project with custom docker containers so no ARM64 version of it. I used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found