Selenium 提供的请求图片的平台与检测到的主机平台不匹配 (linux/arm64/v8)。

huangapple go评论63阅读模式
英文:

Selenium giving requested image's platform does not match the detected host platform (linux/arm64/v8)

问题

在Docker Compose中,我正在使用selenium/standalone-chrome

selenium:
    image: selenium/standalone-chrome
    container_name: selenium
    ports:
      - "4444:4444"

但是我遇到以下错误:

selenium请求的镜像平台(linux/amd64)与检测到的主机平台(linux/arm64/v8)不匹配,且未请求特定平台。

如何修复这个问题?

英文:

In the Docker Compose I'm using selenium/standalone-chrome

selenium:
    image: selenium/standalone-chrome
    container_name: selenium
    ports:
      - "4444:4444"

but I'm getting the following error

> selenium The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

How to fix that?

答案1

得分: 3

根据docker-selenium README

> 对于运行在诸如Mac M1或树莓派等平台上的实验性Docker容器映像,请参阅社区驱动的存储库,托管在seleniumhq-community/docker-seleniarm。这些映像适用于三种不同的架构:linux/arm64(aarch64)、linux/arm/v7(armhf)和linux/amd64。

因此,将映像更改为seleniarm/standalone-chromium

selenium:
    image: seleniarm/standalone-chromium
    container_name: selenium
    ports:
      - "4444:4444"
英文:

According to docker-selenium README

> For experimental docker container images, which run on platforms such as the Mac M1 or Raspberry Pi, see the community driven repository hosted at seleniumhq-community/docker-seleniarm. These images are built for three separate architectures: linux/arm64 (aarch64), linux/arm/v7 (armhf), and linux/amd64.

So, changed the image to seleniarm/standalone-chromium

selenium:
    image: seleniarm/standalone-chromium
    container_name: selenium
    ports:
      - "4444:4444"

答案2

得分: 0

你也可以在 Mac M1 上使用图像 selenium/standalone-chrome,只需按照以下步骤操作:

转到 Docker Desktop 设置 >> 开发中的功能 >> 启用 Apple Silicon 上的 x86/amd64 模拟

实质上,当请求的 Docker 镜像的平台与主机平台不匹配时,会出现此错误。通过启用“Rosetta”选项来进行模拟应该可以减轻此问题,从而使 Docker 能够运行为不同架构构建的镜像。

这个解决方案是从另一个回答中引用的,你可以参考这个链接

英文:

You also can use the image selenium/standalone-chrome on Mac M1, just try to follow this steps:

>> Go to your Docker Desktop settings >> Features in development >> Enable Use Rosetta for x86/amd64 emulation on Apple Silicon

In essence, this error occurs when there is a mismatch between the platform of the requested Docker image and the host platform. Enabling the 'Rosetta' option for emulation should mitigate this issue by allowing Docker to run images built for a different architecture.

This solution was referenced from other questioin which I was answered.

huangapple
  • 本文由 发表于 2023年3月31日 19:19:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75897942.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定