Reputation: 69
I have run the image eboraas/apache-php
with the following command:
docker run --name eboraas -d -p 80:80 -v /my/project/dir/:/var/www/html \
-v /my/config:/etc/apache2 eboraas/apache-php
When I test this I get the server is not found. When I leave the second -v
it works. But how can I change the destination of my apache2 config files then? Without writing them again. For example I want all my config files of the Docker apache in /my/config
.
Upvotes: 2
Views: 1318
Reputation: 903
1st option is create your own image based on the original image eboraas/apache-php(you should create your own Dockerfile) and use COPY in your Dockerfile.
FROM eboraas/apache-php
COPY /my/config /etc/apache2
How it works: when you change your local apache config file you should rebuild image after that and restart container to apply changes.
2nd option is just use docker cp
and run it after every change in your local apache config file:
docker cp /my/config eboraas:/etc/apache2/
You can also copy config file if you change it inside the container:
docker cp eboraas:/etc/apache2/ /my/config
More info https://docs.docker.com/engine/reference/commandline/cp/.
BTW. I will recommend you to use docker-compose because this command is long and not comfortable to use(https://docs.docker.com/compose/).
Upvotes: 2