AH00558: Apache in Docker cannot reliably determine its fully qualified domain name
AH00558: apache2: Could not reliably determine the server's fully qualified domain nameShort 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.
Fix it fast
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 AH005582Match what you see, then jump to its fix
What does the error look like?
AH00558: apache2: Could not reliably determine the server's fully qualified domain nameSet 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 ServerName2Fix
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.conf3Verify
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 AH00558Confirmed by hub.docker.com
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 AH00558Confirmed by httpd.apache.org
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
Servers
apk cannot find py-pip in an Alpine Docker image
py-pip (no such package):
On current Alpine releases there is no package called py-pip.
2 causes, each with a fixServers
ng serve runs in the container but localhost:4200 does not open
The browser cannot open localhost:4200 although ng serve is running in the container
ng serve listens on localhost by default, which inside a container is the container itself.
3 causes, each with a fixServers
Angular routes return 404 from nginx when you refresh or open a link
The home page loads, but refreshing /some/route shows an nginx 404
Angular routes like /users/42 are not files, so nginx looks for them on disk and returns 404.
3 causes, each with a fixServers
Apache in a Docker container logs AH01114 when it proxies to a backend
AH01114: HTTP: failed to make connection to backend: api
Apache's proxy worker could not open a connection to the address in ProxyPass.
5 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
Docker push to Artifact Registry fails from GitHub Actions with a permission error
Permission 'artifactregistry.repositories.uploadArtifacts' denied on resource
The identity your workflow authenticates as lacks the permission artifactregistry.repositories.uploadArtifacts on the target repository.
4 causes, each with a fix