Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker/Cypress Container Failing Due to Qemu Error on M1 Chip

I have a Docker image that I'd like to run locally but I believe it's failing due to an issue with Qemu, which seems to stem from attempting to run Cypress on an M1 chip:

REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
dna          local     097c5f291db5   2 hours ago   3.66GB

When I attempt to run the image locally using docker run dna:local I get the following:

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
yarn run v1.22.10
$ concurrently "yarn:start:ui" "yarn:start:api" "cypress run"
[start:api] $ cd api && yarn start:dev
[start:ui] $ cd ui && yarn start
[2] [STARTED] Task without title.
[start:api] $ DEBUG=socket.io:* DISABLE_AD=1 USE_MEMORY_DB=true nodemon --inspect -r esm ./src/app.js
[2] [FAILED] Cypress failed to start.
[2] [FAILED]
[2] [FAILED] This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies
[2] [FAILED]
[2] [FAILED] Please refer to the error below for more details.
[2] [FAILED]
[2] [FAILED] ----------
[2] [FAILED]
[2] [FAILED] qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[2] [FAILED] qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
[2] [FAILED]
[2] [FAILED]
[2] [FAILED] #
[2] [FAILED] # Fatal error in , line 0
[2] [FAILED] # ignored
[2] [FAILED] #
[2] [FAILED] #
[2] [FAILED] #
[2] [FAILED] #FailureMessage Object: 0x4009bb9420
[2] [FAILED] qemu: uncaught target signal 4 (Illegal instruction) - core dumped

My Dockerfile looks like this:

FROM cypress/browsers:node14.16.0-chrome90-ff88

# Copy the project into the Docker container
COPY . /

# Install the API and UI packages
RUN yarn workspace checkin-api install
RUN yarn workspace checkin-ui install

# Run the e2e test suite
CMD yarn run e2e

Strangely, if I try to specify a platform for the image, Docker complains that it can't find the image locally:

docker run --platform linux/arm64/v8 dna:local

Gets me the following:

Unable to find image 'dna:local' locally
docker: Error response from daemon: pull access denied for dna, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

I assume that the image pulled from the Cypress Docker repository dictates the architecture used as opposed to my --platform flag? If so, is it simply a case that Cypress won't run in a Docker container on my machine?

like image 530
John Peden Avatar asked Jul 23 '21 14:07

John Peden


2 Answers

Looks like there is a known issue with Cypress' Docker containers not working properly with M1 chips:

https://github.com/cypress-io/cypress-docker-images/issues/431

like image 124
John Peden Avatar answered Oct 12 '22 09:10

John Peden


You might need to use the version of Docker built for M1 / Apple Sillicon.

https://docs.docker.com/docker-for-mac/apple-silicon/


Another thing to try would be to build it with the platform, then run it.

docker build -t dna:local --platform linux/arm64/v8 .
like image 41
Craig Harley Avatar answered Oct 12 '22 11:10

Craig Harley