skip to Main Content

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


  1. Chosen as BEST ANSWER

    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:

    -v /share/CACHEDEV1_DATA/Container/apache/conf:/usr/local/apache2/conf
    

    First I had to run the container and copy (docker cp) container_id:/usr/local/apache2/conf into the host.

    No problems since then.


  2. Build your own image based on httpd:latest as it is described here

    FROM httpd:latest
    COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search