title: Docker can't exec init scripts while run Docker start command
body: <p>I created a Docker image based on CentOS 7. I expect the Docker container can automatically start Apache and Tomcat services while I execute the Docker run command.</p>
  
  <p>My docker start command is:</p>
  
  <p><code>sudo docker run --privileged -ti --name apache-tomcat-mobile --rm -v /software:/software -p 81:80 local/web-apache /app/scripts/start-web.sh</code></p>
  
  <p>But I always got this error：</p>
  
  <blockquote>
    <p>exec format errorFATA[0000] Error response from daemon: Cannot start container 7332a91875c1aefb0d6c5160a69fe1c21058c06673b6e4058c81a8641af53baa: exec format error </p>
  </blockquote>
  
  <p>My start-web.sh just has two task, one is the tomcat startup.sh, antoher is the httpd -k start. </p>
  
  <p>I have been set the enough privilege for the start-web.sh.</p>
  
  <p>while I execute 
  `sudo docker run --privileged -ti --name apache-tomcat-mobile --rm -v /software:/software -p 81:80 local/web-apache /bin/bash, there are no error happen. </p>
  
  <pre><code>The docker file I used based on CentOS7. The bas docker file is :
  FROM centos:7
  MAINTAINER "edao99" &lt;jianghy_bj@hotmail.com&gt;
  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/; for i in *; do [ $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"]
  
  The actually docker filed used for apache and tomcat is inherited from the base docker. The apache docker file is:
  FROM 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"]
  </code></pre>
  
  <p>I searched the solution from internet and I didn't find a similar issue.
  Can anyone help me to resolve this problem?</p>
  
  <p>Thanks.</p>