I want access /etc/php5/apache2 in my container, where f.e. php.ini is located.

As soon as I mount my volume...it seems the container can't write the default php.ini to the apache2 folder, because apache2 folder and config folder on host are empty.

docker config:

  • ./config/:/etc/php5/apache2

I have also tested Z flag without any success. Folder config on host is read/write/excutable by everyone.


A volume shadows data in the container, e.g. if there is bla.txt in the folder in the container, after mounting you won't see the file. If you only need to see the file, you can go into the the container using docker exec -it <id> /bin/sh and then look into the file. Alternatively use docker cp to copy the file, but I never needed that.

  • Thanks! I will use it to update container generated php.ini from host side and make it persistent. If I understand you correctly then the empty folder from host always overwrites the container folder? What's the recommend way? Exec -it works...but is not persistent, – robert Jun 7 at 10:23
  • What you want? It looks like a config file? If so, the docker way is to use env variables or config files. Which to use depends, e.g. on the number of settings. For your file, you could place it in the host container – Christian Sauer Jun 7 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.