Docker PHP-APACHE container set the ServerName directive globally

Voila thanks to aserre for the help:

FROM php:7.0-apache
COPY . /var/www/html/
EXPOSE 80
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

Do it like you would do on a regular system:

FROM php:7.0-apache
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
COPY . /var/www/html/
EXPOSE 80

You can change the server name to suit your configuration.


If you are using Centos as base, it should look like this:

RUN echo "ServerName localhost" >> /etc/httpd/conf/httpd.conf
CMD apachectl -DFOREGROUND

regards