简体   繁体   English

IBM Cloud Code Engine:本地构建的容器镜像在部署时出现 exec 格式错误

[英]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:但以下不起作用:

  • Push the image to the Container Registry in IBM Cloud将映像推送到 IBM Cloud 中的 Container Registry
  • Create an application in Code Engine using the image使用图像在代码引擎中创建应用程序

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:有两种解决方法:

  1. Use Code Engine to build the container images . 使用 Code Engine 构建容器镜像
  2. Use 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.

相关问题 带有ssh的Docker exec没有给出这样的容器错误 - Docker exec with ssh gives no such container Error GCP Cloud Run 部署 Docker 容器未启动,因为 nginx 图像无法找到 error.log - GCP Cloud Run deployed Docker container does not start because of nginx image is failing to find error.log AWS Lambda Alpine Python Container 显示 IMAGE Launch 错误 exec 格式错误 - AWS Lambda Alpine Python Container shows IMAGE Launch error exec format error nginx 部署到 ECS 时无法解析容器名称,在本地工作 - nginx unable to resolve container name when deployed to ECS, works locally React Flask 应用程序可在 Docker 容器中运行,但在部署到 Cloud Run 时返回 404 错误 - React Flask app works in Docker container but returns 404 error when deployed to Cloud Run 尝试在docker容器中运行简单的flask应用程序时出现“OSError:[Errno 8] Exec格式错误” - “OSError: [Errno 8] Exec format error” when trying to run simple flask app in a docker container 从 arm32v7 golang 映像构建 docker 映像时执行格式错误 - exec format error when building docker image from arm32v7 golang image ECS Fargate 任务无法启动:“standard_init_linux.go:228:exec 用户进程导致:exec 格式错误”即使是为 amd64 构建的 - ECS Fargate task failing to start: "standard_init_linux.go:228: exec user process caused: exec format error" even when built for amd64 无法启动容器:[8]系统错误:exec格式错误 - Cannot start container: [8] System error: exec format error 尝试安装 Docker 映像时,Docker 构建错误“exec 格式错误” - Docker build error “exec format error” when trying to install an docker image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM