I’m new to docker and I’m trying to create a new php (apache) image. I want to externalize the /etc/apache2, /var/www/html, and /usr/local/etc/php directories so they don’t live within the container, but live on my main system which docker is running on.
Here is my simple Dockerfile that I used:
FROM php:7.0-apache
VOLUME ["/var/www/html", “/etc/apache2”, “/usr/local/etc/php”]
Then when I built that and created a container:
docker create
–name apache
–restart=always
-v /home/user/apache/conf:/etc/apache2
-v /home/user/apache/html:/var/www/html
-v /home/user/apache/php:/usr/local/etc/php
-e TZ=America/New_York
-p 80:80 -p 443:443
apache
When I start the container, the /etc/apache2 configs are all missing… I’m expecting them to get populated within my /home/user/apache/conf directory upon container startup… What am I doing wrong? I’ve run other containers from linuxserver.io where I setup a /config directory similarly and all the config gets auto-populated on it’s own when I start the container. Thanks in advance.