I created Dockerfile to build my image called aii.
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}
When I run the image with the following command:
docker run -it -v <some-volume-mapping> aii
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:
docker run -it -v <some-volume-mapping> aii start-aii.sh kafka
exec format error
docker: Error response from daemon: Cannot start container b3f4f3bde04d862eb8bc619ea55b7061ce78ace8f1984a12f6ec681877d7d926: [9] System error: exec format error.
I also tried: only script (without argument)
docker run -it -v <some-volume-mapping> aii start-aii.sh
and full path to script
docker run -it -v <some-volume-mapping> aii /usr/local/bin/start-aii.sh
but the same error appear.
Another info:
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2488a4dd7014 aii "start-aii.sh kafka" 3 seconds ago Created tiny_payne
Any suggestions?
Thanks
Had the same issue, fixed it by adding #!/bin/sh
at the top of the file instead of having other comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With