[英]IBM Cloud Code Engine: Locally built container image gives exec format error when deployed
I have created a container image on my machine (Mac).我在我的机器 (Mac) 上创建了一个容器镜像。 When testing it locally, all works fine.
在本地测试时,一切正常。 But the following does not work:
但以下不起作用:
It produces this error:它会产生此错误:
exec /usr/local/bin/docker-entrypoint.sh: exec format error
exec /usr/local/bin/docker-entrypoint.sh: exec 格式错误
I've looked in to the docker-entrypoint.sh and that seems to be ok.我查看了 docker-entrypoint.sh ,似乎没问题。 What is wrong?
怎么了? How do I address it?
我该如何解决?
Code Engine runs on x86 machines internally.代码引擎在内部运行在 x86 台机器上。 In order to push an image to CE that has been built on a M1 Mac, please add
docker build --platform linux/amd64...
when you do your docker build.为了将在 M1 Mac 上构建的映像推送到 CE,请在执行 docker 构建时添加
docker build --platform linux/amd64...
The reason for the problem is the chip architecture.问题的原因是芯片架构。 IBM Cloud Code Engine is based on the Intel x86 architecture, many Mac computers use ARM 64 (M1 or similar).
IBM Cloud Code Engine 基于 Intel x86 架构,许多 Mac 计算机使用 ARM 64(M1 或类似)。 There are two options to work around it:
有两种解决方法:
docker build --platform linux/amd64
to specify the build platform in your local builds.docker build --platform linux/amd64
在本地构建中指定构建平台。 Also, check out the Code Engine FAQs and the Troubleshooting section .此外,请查看代码引擎常见问题解答和故障排除部分。
Which CPU do you have on your Mac?您的 Mac 上有哪个 CPU? Currently, Code Engine can't run images that have been build on a M1 ARM 64 machine.
目前,代码引擎无法运行在 M1 ARM 64 机器上构建的图像。
You can add this parameter your local docker build command..您可以在本地 docker 构建命令中添加此参数。
docker build --platform linux/amd64 ...
Or you can use a Code Engine Build to do it for you.或者您可以使用 Code Engine Build 为您完成。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.