Docker 在 Mac 上是否有办法在没有 linux/arm64 镜像时回退到 linux/amd64?

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

Is there a way to have Docker on Mac fallback to linux/amd64 when a linux/arm64 image is not available?

问题

I am using a Mac with an M1 chip for development work. When using Docker to run various containers (via docker-compose), I often have to modify the docker-compose.yml file to specify platform: linux/amd64 (and make sure the docker-compose.yml's version is at least 2.4).

Here is an example of the type of error message I frequently see:

Error response from daemon: image with reference phpmyadmin/phpmyadmin:5 was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64 

Is there a way to have Docker / Docker Compose (on a Mac) try to use the linux/arm64 version, but if it's not available, automatically fall back to the linux/amd64 image?

英文:

I am using a Mac with an M1 chip for development work. When using Docker to run various containers (via docker-compose), I often have to modify the docker-compose.yml file to specify platform: linux/amd64 (and make sure the docker-compose.yml's version is at least 2.4).

Here is an example of the type of error message I frequently see:

Error response from daemon: image with reference phpmyadmin/phpmyadmin:5 was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64

Is there a way to have Docker / Docker Compose (on a Mac) try to use the linux/arm64 version, but if it's not available, automatically fall back to the linux/amd64 image?

答案1

得分: 2

你可以执行 export DOCKER_DEFAULT_PLATFORM=linux/amd64,但这不会成为一个回退选项,会阻止你在有原生镜像可用时使用它们。

编辑:上游功能请求:
https://github.com/docker/compose/issues/10579

英文:

You can export DOCKER_DEFAULT_PLATFORM=linux/amd64 but that won't be a fallback and will prevent you from using native images whenever available.

EDIT: upstream feature request:
https://github.com/docker/compose/issues/10579

huangapple
  • 本文由 发表于 2023年5月10日 23:58:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76220506.html
匿名

发表评论

匿名网友

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

确定