创建POD时,它将进入CrashloopBackoff。 logs显示“ exec/usr/local/bin/bin/docker-entrypoint.sh:exec格式错误。”

发布于 2025-01-24 17:11:06 字数 1062 浏览 2 评论 0 原文

  1. 使用WordPress php-apache-7.4作为基本图像,我创建了一个具有很少自定义的Docker文件,并创建了一个图像。我正在使用同一docker-entrypoint.sh,wp-config-docker.php文件中的docker Hub官方图像。

  2. 在我在Docker桌面上创建一个容器时使用图像,它可以正常工作,我可以加载WP页

  3. 我将同一图像上传到Docker Hub并从那里,并使用该图像在EKS群集上创建了一个POD,我接收到错误“ exec/usr/local/bin/docker-entrypoint.sh:exec格式错误。”

我正在使用以下存储库中的文件

仅修改上述存储库中的Docker文件,已修改以安装Memcached并复制WP-Config.php。我使用的其他两个文件没有任何更改。

我尝试更改docker-entrypoint.sh脚本以添加#!/bin/bash ,如某些问题所述,我也尝试创建一个custom-entrypoint.sh来编辑原始docker-entrypoint .SH脚本在另一页中也建议,但它们没有起作用。

custom-entrypoint.sh

#!/bin/bash
sed -i -e 's/^exec "$@"/#exec "$@"/g' /usr/local/bin/docker-entrypoint.sh
source docker-entrypoint.sh
exec "$@"

试图解决此问题,唯一的事情是令人困惑的是,当我使用相同的图像创建它运行cont而没有任何错误时,在docker桌面上。

  1. Using WordPress php-apache-7.4 as base image, I created a Docker file with few customisation and created an image. I am using the same docker-entrypoint.sh, wp-config-docker.php files from the Docker Hub official image.

  2. Using the image when I create a container on Docker Desktop it works fine and I am able to load the WP page

  3. I upload the same image to Docker Hub and from there and using that image created a pod on EKS cluster and I receive the error "exec /usr/local/bin/docker-entrypoint.sh: exec format error."

I am using the files from the below repo
https://github.com/docker-library/wordpress/tree/3b5c63b5673f298c14142c0c0e3e51edbdb17fd3/latest/php7.4/apache

Only Docker file in the above repo is modified to installed the memcached and copy wp-config.php. The other two files I am using without any changes.

I tried changing the docker-entrypoint.sh script to add #!/bin/bash as mentioned in some issue reported, also I tried to create a custom-entrypoint.sh to edit the original docker-entrypoint.sh script which was also suggested in another page but they didn't work.

custom-entrypoint.sh

#!/bin/bash
sed -i -e 's/^exec "$@"/#exec "$@"/g' /usr/local/bin/docker-entrypoint.sh
source docker-entrypoint.sh
exec "$@"

Trying to fix this, only thing is confusing is on Docker Desktop when I create using the same image it runs the cont without any error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清晰传感 2025-01-31 17:11:06

正如David Maze上面的评论中提到的那样,问题归因于Mac M1 Pro上的图像。

时运行以下命令。

要解决此问题,我需要从-platform = linux/amd64< image> - < version> 添加 ,或者您可以在运行构建 docker build --platform = linux/amd64< image> - <版本>

两个解决方案都可以使用。我从-platform = linux/amd64 添加到dockerfile,现在已修复。

As mentioned in the comment above by David Maze, the issue is due to building the image on Mac M1 Pro.

To fix this I need to add FROM --platform=linux/amd64 <image>-<version> in the Dockerfile and build or you can run the below command while running the build

docker build --platform=linux/amd64 <image>-<version>

Both solutions will work. I added FROM --platform=linux/amd64 to the Dockerfile and it's fixed now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文