Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

AH00558: Apache in Docker cannot reliably determine its fully qualified domain name

ErrorAH00558: apache2: Could not reliably determine the server's fully qualified domain name

Short answer

AH00558 is a warning, not a crash. Apache had no ServerName set, so it tried a reverse DNS lookup of the container's IP and failed. Add a ServerName line to the main httpd.conf, and for the official httpd image copy your edited file to /usr/local/apache2/conf/httpd.conf.

  • Applies to Apache httpd 2.4, Docker Engine 28, httpd official image
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Check whether the container is actually serving. If the page loads, the message is only a warning and the fix is cosmetic and safe.

    docker ps
    docker logs my-running-app 2>&1 | grep AH00558
  2. 2Match what you see, then jump to its fix

    1. 1AH00558 appears once at start, with the container's IP address in the messageNo ServerName in the main server configurationFix
    2. 2The message stays after a global ServerName is set, and you have <VirtualHost> blocksA virtual host has no ServerName of its ownFix

What does the error look like?

  • AH00558: apache2: Could not reliably determine the server's fully qualified domain name
  • Set the 'ServerName' directive globally to suppress this message

Cause 1 of 2

No ServerName in the main server configuration

1Check

Apache has no configured name, so it asks DNS for the name of its own IP. A container IP often has no reverse record. Print the default config from the image and look for a ServerName line.

docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf | grep -n ServerName

2Fix

Copy the default file out of the image, add a ServerName line, and copy it back in your Dockerfile, as the image documentation describes for custom configuration.

docker run --rm httpd:2.4 cat /usr/local/apache2/conf/httpd.conf > my-httpd.conf
echo "ServerName localhost" >> my-httpd.conf

# Dockerfile
FROM httpd:2.4
COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf

3Verify

Rebuild, run, and confirm the message is gone from the logs.

docker build -t my-apache2 .
docker run -dit --name my-running-app -p 8080:80 my-apache2
docker logs my-running-app 2>&1 | grep -c AH00558

Confirmed by hub.docker.com

Did this fix it?

Cause 2 of 2

A virtual host has no ServerName of its own

1Check

The Apache DNS notes say a virtual host without a ServerName is named through reverse DNS, and if that fails a name-based host is effectively disabled. List the virtual hosts and look for blocks with no ServerName.

docker exec my-running-app grep -rn -E 'VirtualHost|ServerName' /usr/local/apache2/conf/

2Fix

Give every virtual host an explicit ServerName with its real host name.

<VirtualHost *:80>
  ServerName www.example.com
  DocumentRoot "/usr/local/apache2/htdocs"
</VirtualHost>

3Verify

Restart the container and check the log.

docker restart my-running-app
docker logs my-running-app 2>&1 | grep AH00558

Confirmed by httpd.apache.org

Did this fix it?

How do I stop it coming back?

  • Keep httpd.conf in your repository and copy it into the image, so the name is set on every build.
  • Give each virtual host its own ServerName instead of relying on reverse DNS.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.