0

I have a Docker container within a Tomcat server. I would like to access to the conf files of the server from the host. In this way, i tried to run my container with these options :

docker run -v /home/empty_dir:/usr/local/tomcat/conf test

The /conf directory is well created on the host but is empty and thus the server cannot start... So, I'm looking for a solution to populate my dir with the default conf file of the server in the container.

agentn
  • 33
  • 1
  • 5
  • I also tried to create my dir /home/conf, but it seems to be the same problem – agentn Aug 08 '18 at 13:11
  • Possible duplicate of [Copying files from Docker container to host](https://stackoverflow.com/questions/22049212/copying-files-from-docker-container-to-host) – David Maze Aug 08 '18 at 13:14
  • `docker run -v` will always effectively "overwrite" image contents with host-filesystem contents in a new container (with a very specific exception this probably doesn't hit). But you could use `docker cp` to copy the content out of the image, and then when you launch a new container you'll have a copy of the config tree to start from. – David Maze Aug 08 '18 at 13:17
  • yes, it was my 'last' solution, but i found it dirty and though a way to do it more properly existed ^^ anyway thx for your help – agentn Aug 08 '18 at 13:19
  • i still have the problem but now with my logs, the files are not created in the shared volume. It's a problem because i would like to get these logs from another service to print them (and i cannot user `docker volume` because i need these logs in a specific dir on the host) ... any ideas ? – agentn Aug 09 '18 at 13:07

0 Answers0