apache - Docker can't exec init scripts while run Docker start command -


i created docker image based on centos 7. expect docker container can automatically start apache , tomcat services while execute docker run command.

my docker start command is:

sudo docker run --privileged -ti --name apache-tomcat-mobile --rm -v /software:/software -p 81:80 local/web-apache /app/scripts/start-web.sh

but got error:

exec format errorfata[0000] error response daemon: cannot start container 7332a91875c1aefb0d6c5160a69fe1c21058c06673b6e4058c81a8641af53baa: exec format error

my start-web.sh has 2 task, 1 tomcat startup.sh, antoher httpd -k start.

i have been set enough privilege start-web.sh.

while execute `sudo docker run --privileged -ti --name apache-tomcat-mobile --rm -v /software:/software -p 81:80 local/web-apache /bin/bash, there no error happen.

the docker file used based on centos7. bas docker file : centos:7 maintainer "edao99" <jianghy_bj@hotmail.com> env container docker run yum -y swap -- remove fakesystemd -- install systemd systemd-libs run yum -y update; yum clean all;\ (cd /lib/systemd/system/sysinit.target.wants/; in *; [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done);\ rm -f /lib/systemd/system/multi-user.target.wants/*;\ rm -f /etc/systemd/system/*.wants/*;\ rm -f /lib/systemd/system/local-fs.target.wants/*; \ rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ rm -f /lib/systemd/system/basic.target.wants/*;\ rm -f /lib/systemd/system/anaconda.target.wants/*; volume [ "/sys/fs/cgroup" ] cmd ["/usr/sbin/init"]  docker filed used apache , tomcat inherited base docker. apache docker file is: local/c7-systemd run yum -y install gcc; yum clean all; run yum -y install httpd; yum clean all; run yum -y install apr-util-devel; yum clean all; run yum -y install httpd-devel; yum clean all; run yum -y install wget; yum clean all; run yum -y install make; yum clean all; run yum -y install tar; yum clean all; run systemctl enable httpd.service expose 80 cmd ["/usr/sbin/init"] 

i searched solution internet , didn't find similar issue. can me resolve problem?

thanks.

you need copy script run container before can use command. you'll need add line dockerfile such as:

copy start-web.sh /app/scripts/start-web.sh 

make sure place start-web.sh in build context.

also, build file lot simpler if got rid of systemd stuff. if have have more 1 process, using simpler process management tool such supervisor or runit or write own shell script start services.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -