Browse Source

fix apache2 issue on container restart

SiM 5 years ago
parent
commit
5104d74921
2 changed files with 13 additions and 1 deletions
  1. 5 1
      docker/apache-php/Dockerfile
  2. 8 0
      docker/apache-php/start-apache.sh

+ 5 - 1
docker/apache-php/Dockerfile

@@ -20,7 +20,11 @@ RUN a2enmod headers
 # PHP
 RUN php5enmod imagick
 
-CMD ["/usr/sbin/apache2ctl", "-D" ,"FOREGROUND"]
+# Simple startup script to avoid some issues observed with container restart 
+ADD start-apache.sh /start-apache.sh
+RUN chmod -v +x /start-apache.sh
+
+CMD ["/start-apache.sh"]
 
 EXPOSE 80
 EXPOSE 443

+ 8 - 0
docker/apache-php/start-apache.sh

@@ -0,0 +1,8 @@
+#!/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/apache2/*
+
+exec /usr/sbin/apache2ctl -D FOREGROUND