Could not reliably determine the server's fully qualified domain name … How to solve it in Docker?

后端 未结 3 1305
感动是毒
感动是毒 2021-01-31 16:48

I am just starting in Docker and I was following that tutorial that shows basically these steps:

  1. Create a Dockerfile like this:

    From php:7.0-apach

3条回答
  •  故里飘歌
    2021-01-31 17:36

    To avoid that warning, you can set the ServerName with you IP.

    See this example: tagplus5/docker-php/7-apache/Dockerfile

        apt-get install -y --no-install-recommends iproute2 apache2 php7.0 libapache2-mod-php7.0 \
            php7.0-mysql php7.0-sqlite php7.0-bcmath php7.0-curl ca-certificates && \
        apt-get autoremove -y && \
        rm -rf /var/lib/apt/lists/* && \
    echo "ServerName $(ip route get 8.8.8.8 | awk '{print $NF; exit}')" >> /etc/apache2/apache2.conf && \
    

    (although iproute can work differently on a Mac: it depends on your host. See iproute2mac issue 8)

提交回复
热议问题