有没有办法使用Docker堆栈在苹果硅(ARM)上部署X86图像?
我们使用用于 x86 的服务的Docker堆栈组成文件。为了使我们的开发设备在我的苹果硅/M1/ARM芯片上本地运行,我试图使用Docker堆栈部署部署堆栈。该服务不会在节点上引用不受支持的体系结构而运行和失败。有没有办法在我的Docker Swarm节点上模仿Intel架构?还是使用Rosetta运行X86服务?
- 平台
flag >似乎对Docker堆栈不起作用。
We have a Docker stack compose file using services built for x86. To get our dev-setup running locally on my Apple Silicon/M1/ARM chip, I tried to deploy the stack using docker stack deploy. The services won't run and fail citing the unsupported architecture on the node. Is there a way to emulate an intel architecture on my docker swarm node? Or to run the x86 services using rosetta?
The --platform
flag mentioned in the docs does not seem to work for the Docker stack.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们找到了一个解决方案:
docker stack
部署预构建的图像。对于任何没有手臂构建的服务,您将获得“不支持的平台”错误。使用
- 平台Linux/AMD64
技巧不适用于Docker堆栈,因为它没有- Platform
选项。相反,您需要做的是:确保堆栈的服务本地可用(例如,通过执行Docker stack与Docker stack YML文件部署,该文件再次将无法启动服务,但下载它们)。 /p>
添加
- resolve-image“ nover”
在您的docker stack部署中,例如:docker stack deplotion -resolve-resolve-image“ nover” - compose-file =。/compose-file =。 stack.yml
现在,在X86服务的背景下,使用Rosetta/Qemu仿真开始了服务。不建议这样做,可能导致行为错误和表现不佳。例如,就我而言,X86 KeyCloak映像将启动但行不通。在这种情况下,有必要在本地为ARM构建服务。
We have found a solution:
docker stack
deploys pre-built images. You will get an "unsupported platform" error for any service which doesn't have an arm-build.Using the
--platform linux/amd64
trick doesn't work for docker stack because it has no--platform
option. What you need to do instead is:make sure the services of the stack are locally available (for example by executing docker stack deploy with you docker stack yml file, which again will fail to start the services but download them).
add
--resolve-image "never"
to your docker stack deploy, for example:docker stack deploy --resolve-image "never" --compose-file=./stack.yml
Now the services will started, using rosetta/qemu emulation in the background for the x86 services. This is not advised and can lead to faulty behavior and bad performance. For example, in my case the x86 keycloak image would start but not work. In those cases, it is necessary to build the service locally for arm.
以下命令对我有用:
The following command worked for me: