英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论