我有一个 Docker 镜像,我想在本地运行,但我认为它失败是由于 Qemu 的问题,这似乎源于试图在 M1 芯片上运行 Cypress:
REPOSITORY TAG IMAGE ID CREATED SIZE
dna local 097c5f291db5 2 hours ago 3.66GB
当我尝试使用 docker run dna:local
在本地运行图像时,我得到以下信息:
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
我的 Dockerfile 如下所示:
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
奇怪的是,如果我尝试为镜像指定平台,Docker 会抱怨在本地找不到镜像:
docker run --platform linux/arm64/v8 dna:local
为我提供以下信息:
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'.
我假设从 Cypress Docker 存储库中提取的图像决定了所使用的架构,而不是我的 --platform 标志?如果是这样,这仅仅是因为 Cypress 不会在我机器上的 Docker 容器中运行吗?
答案 0 :(得分:1)
您可能需要使用为 M1 / Apple Silicon 构建的 Docker 版本。
https://docs.docker.com/docker-for-mac/apple-silicon/
要尝试的另一件事是使用平台构建它,然后运行它。
docker build -t dna:local --platform linux/arm64/v8 .
答案 1 :(得分:1)
看起来 Cypress 的 Docker 容器存在一个已知问题,无法与 M1 芯片一起正常工作:
https://github.com/cypress-io/cypress-docker-images/issues/431