docker run [9] System error: exec format error
<p>I created Dockerfile to build my image called aii.</p>

<pre><code>FROM docker.io/centos:latest

#Set parameters
ENV BinDir /usr/local/bin
ENV RunFile start-aii.sh

ADD ${RunFile} ${BinDir}
#Some other stuff
...

CMD ${RunFile}
</code></pre>

<p>When I run the image with the following command:</p>

<pre><code>docker run -it -v &lt;some-volume-mapping&gt; aii
</code></pre>

<p>it's works great (default operation of running CMD command of start-aii.sh).
Now, if I try to override this default behavior and to run the image with the same script implicitly (and add another arg) I'm getting the following error:</p>

<pre><code>docker run -it -v &lt;some-volume-mapping&gt; aii start-aii.sh kafka
exec format error
docker: Error response from daemon: Cannot start container b3f4f3bde04d862eb8bc619ea55b7061ce78ace8f1984a12f6ec681877d7d926: [9] System error: exec format error.
</code></pre>

<p>I also tried: only script (without argument) </p>

<pre><code>docker run -it -v &lt;some-volume-mapping&gt; aii start-aii.sh
</code></pre>

<p>and full path to script</p>

<pre><code>docker run -it -v &lt;some-volume-mapping&gt; aii /usr/local/bin/start-aii.sh
</code></pre>

<p>but the same error appear.</p>

<p>Another info:</p>

<pre><code>docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
2488a4dd7014        aii                 "start-aii.sh kafka"     3 seconds ago       Created                                 tiny_payne
</code></pre>

<p>Any suggestions?</p>

<p>Thanks</p>