<ol>
<li><p>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.</p>
</li>
<li><p>Using the image when I create a container on Docker Desktop it works fine and I am able to load the WP page</p>
</li>
<li><p>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 &quot;exec /usr/local/bin/docker-entrypoint.sh: exec format error.&quot;</p>
</li>
</ol>
<p>I am using the files from the below repo
<a href="https://github.com/docker-library/wordpress/tree/3b5c63b5673f298c14142c0c0e3e51edbdb17fd3/latest/php7.4/apache" rel="noreferrer">https://github.com/docker-library/wordpress/tree/3b5c63b5673f298c14142c0c0e3e51edbdb17fd3/latest/php7.4/apache</a></p>
<p>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.</p>
<p>I tried changing the docker-entrypoint.sh script to add <code>#!/bin/bash</code> 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.</p>
<p>custom-entrypoint.sh</p>
<pre><code>#!/bin/bash
sed -i -e 's/^exec &quot;$@&quot;/#exec &quot;$@&quot;/g' /usr/local/bin/docker-entrypoint.sh
source docker-entrypoint.sh
exec &quot;$@&quot;
</code></pre>
<p>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.</p>

<p>As mentioned in the comment above by David Maze, the issue is due to building the image on Mac M1 Pro.</p>
<p>To fix this I need to add <code>FROM --platform=linux/amd64 &lt;image&gt;-&lt;version&gt;</code> in the Dockerfile and build or you can run the below command while running the build</p>
<p><code>docker build --platform=linux/amd64 &lt;image&gt;-&lt;version&gt;</code></p>
<p>Both solutions will work. I added <code>FROM --platform=linux/amd64</code> to the Dockerfile and it's fixed now.</p>
