Преглед на файлове

fix apache2 issue on container restart

SiM преди 6 години
родител
ревизия
5104d74921
променени са 2 файла, в които са добавени 13 реда и са изтрити 1 реда
  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