I’m spinning up a docker container using:
docker run -d
--add-host=host.docker.internal:host-gateway
--name=apache
--restart always
-e PUID=1000
-e PGID=1000
-e TZ=Europe/London
-p 80:80
-v /share/CACHEDEV1_DATA/Container/apache/config/httpd.conf:/usr/local/apache2/conf/httpd.conf
-v /share/CACHEDEV1_DATA/Container/apache/config/httpd-vhosts.conf:/usr/local/apache2/conf/extra/httpd-vhosts.conf
httpd:latest
Unfortunately, the httpd.conf
file within the container does not match the local file in the host. Interestingly, the httpd-vhosts.conf
file within the container matches the local file in the host.
2
Answers
For anyone else having the same issue, I've solved this by placing the whole
conf
directory in the host and mapping it in the docker run with:First I had to run the container and copy (docker cp) container_id:/usr/local/apache2/conf into the host.
No problems since then.
Build your own image based on httpd:latest as it is described here
Assuming you do not care about frequent configuration changes, which requires restarting Apache anyway, for performance reasons, it is better to have this copied directly to the image.