title: Apache couldn't determine servername on docker container
body: <p>I am trying to set up a customized docker container for an existing site. To do so I want to provide my own custom <code>vhost</code> configuration with a <code>ServerName</code>. </p>
  
  <p>But when I try to add a custom <code>vhost configuration</code> and restart apache I get the warning that Apache was unable to determine the global name: <code>Could not reliably determine the server's fully qualified domain name, using 172.26.0.2. Set the 'ServerName' directive globally to suppress this message</code></p>
  
  <p>What's important is the fact that when I log into container's shell and manually run <code>service apache2 restart</code> I do not get this warning anymore.</p>
  
  <p>How can I suppress that on the build? Should I provide the <code>vhost</code> to the composer somehow else?</p>
  
  <p>Here is my <code>docker-compose.yml</code> is like:</p>
  
  <pre><code>version: '3'
  services:
    web:
      build:
        context: ./etc/php
        args:
           - APP_HOST=${APP_HOST}
      ports:
        - ${APP_PORT}:80
        - ${APP_PORT_SSL}:443
      volumes:
        - ./var/bin/:/tmp/bin/
        - ./app/:/var/www/html/
        - ./log/:/var/log/
        - ./etc/php/conf/:/usr/local/etc/php/conf.d/
      environment:
        - VIRTUAL_HOST=${VIRTUAL_HOST}
  </code></pre>
  
  <p>Then, <code>Dockerfile</code> that adds my own available site:</p>
  
  <pre><code>FROM php:7.0-apache
  ENV TERM=xterm
  LABEL maintainer="Derek P Sifford &lt;dereksifford@gmail.com&gt;" \
        version="0.15.2-php7.0"
  
  ARG APP_HOST
  ENV APP_HOST=$APP_HOST
  
  ADD ./sites/app.conf /etc/apache2/sites-available/app.conf
  RUN sed -i 's/ServerName APP_HOST/ServerName '$APP_HOST'/g' /etc/apache2/sites-available/app.conf
  
  RUN sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf \
      &amp;&amp; a2enmod rewrite expires \
      &amp;&amp; a2dissite 000-default.conf \
      &amp;&amp; a2ensite app.conf \
      &amp;&amp; service apache2 restart
  
  WORKDIR /app
  EXPOSE 80 443
  </code></pre>
  
  <p>And obviously site config:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      DocumentRoot "/var/www/html"
      ServerName APP_HOST
  
      SetEnv APPLICATION_ENV "development"
  
      &lt;Directory "/var/www/html"&gt;
          DirectoryIndex index.php
          AllowOverride All
          Order allow,deny
          Allow from all
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>