简体   繁体   中英

Docker unable to run a shell script inside a container using dockerfile

I am facing a highly trivial problem wherein the shell script "httpd-service.sh" is not getting executed in the below Dockerfile.

FROM localhost:5000/httpd_custom_image:v6
WORKDIR /opt
ADD httpd-service.sh .
EXPOSE 80
CMD ["/bin/sh","/opt/httpd-service.sh"]

Below is the content of the httpd-service.sh

#!/bin/bash
/usr/local/apache2/bin/httpd

The script httpd-service.sh is getting copied inside /opt in container and has permissions.

Below is the docker version,

[root@vfecare-3 temp]# docker --version
Docker version 17.03.0-ce, build 3a232c8

Can someone let me know what is breaking here?

Got it working in the foreground with the below lines in the Dockerfile.

CMD ["-D", "FOREGROUND"]
ENTRYPOINT ["/usr/sbin/httpd"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM