Docker Community Forums

Share and learn in the Docker community.

[ System error: exec format error ] when I start the container


(Ameyrk) #1

Hi Guys,

I have one container and within that container I have one (/usr/local/portalTomcat/bin/start.sh) script.

The /usr/local/portalTomcat/bin/start.sh contains below 2 lines.The 1st line starts the apache and second one tomcat.
nohup apachectl start &
nohup /usr/local/portalTomcat/bin/startup.sh &

However, when I start the container I get the below error.

docker@boot2docker:/c/Users/inakamble/my_images/apacheportal$ docker run -itd -p 80:80 -p 443:443 -p 8006:8006 -p 8010:8010 -p 8081:8081 -p 8443:8443 apache_
portal:0.7
5de2f7be9dd26251863c743e6aba11798d86625b60c6b8316bca7d9d301ed093
Error response from daemon: Cannot start container 5de2f7be9dd26251863c743e6aba11798d86625b60c6b8316bca7d9d301ed093: [8] System error: exec format error

Could you please advise what might the error that I may be committing or am I missing something ?

Best Regards,
Amey


(Ranjandas) #2

Hi,

Can you add #!/bin/bash or #!/bin/sh to the script file and build the image again and try to run?

#!/bin/sh
nohup apachectl start &
nohup /usr/local/portalTomcat/bin/startup.sh &

Regards


(Ameyrk) #3

Tried that too. In this the error has disappeared now. However, the container is not starting please see the o/p below.

docker@boot2docker:/c/Users/inakamble/my_images/apacheportal$ docker run -itd -p 80:80 -p 443:443 -p 8006:8006 -p 8010:8010 -p 8081:8081 -p 8443:8443 apache_
portal:0.7
d2aed98e12ac6af832adc905754dffb2f3e5cf2bc38cccb53270102e92cfa7fb

docker@boot2docker:/c/Users/inakamble/my_images/apacheportal$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

docker@boot2docker:/c/Users/inakamble/my_images/apacheportal$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d2aed98e12ac apache_portal:0.7 “/usr/local/portalTom” 12 seconds ago Exited (0) 10 seconds ago admiring_wright

Thanks,
amey


(Ranjandas) #4

Hi,

Somehow the script that you are using as existing with an exit status of 0. You should make sure that the script should not exit, for that you may have to run both httpd and tomcat in your container in foreground rather than sending it to background.

You can get some input for this by looking at the official httpd and tomcat images on how this is achieved.

Regards