FROM centos:latest MAINTAINER by huangbin RUN yum -y update; yum clean all RUN yum -y install httpd && yum clean all RUN touch /var/www/html/index.html RUN echo "Hello,Docker" >>/var/www/html/index.html EXPOSE 80 #Simple startup script to avoid some issues observed with container restart ADD run-httpd.sh /run-httpd.sh RUN chmod -v +x /run-httpd.sh CMD ["/run-httpd.sh"]
#!/bin/bash # Make sure we're not confused by old, incompletely-shutdown httpd # context after restarting the container. httpd won't start correctly #if it thinks it is already running. rm -rf /run/httpd/* exec /usr/sbin/apachectl -D FOREGROUND