Php – Docker PHP-APACHE container set the ServerName directive globally

apachedockerdockerfilePHP

I get this warning when i try to run my php:apache container on docker please any idea how to solve this.

AH00558: apache2: Could not reliably determine the server's fully
qualified domain name, using 172.17.0.2. Set the 'ServerName'
directive globally to suppress this message AH00558: apache2: Could
not reliably determine the server's fully qualified domain name, using
172.17.0.2. Set the 'ServerName' directive globally to suppress this message [Mon Feb 19 14:18:21.041074 2018] [mpm_prefork:notice] [pid 1]
AH00163: Apache/2.4.10 (Debian) PHP/7.0.27 configured — resuming
normal operations [Mon Feb 19 14:18:21.041534 2018] [core:notice] [pid
1] AH00094: Command line: 'apache2 -D FOREGROUND'

DOCKERFILE:

FROM php:7.0-apache
COPY . /var/www/html/
EXPOSE 80

Best Answer

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.