I am still relatively new to Docker, so I haven't quite figured out all the nuances yet, so forgive me if this has already been resolved elsewhere.
I would like to share files between the container and the host.
So far I have been using volumes, and mounting a specific host directory to a container directory - but this presents an issue in that, if the host directory is messed around with, these changes are also present in the container.
Another problem I am experiencing is that if the host directory is empty, and is mounted to a pre-existing directory on the container, then the contents of the directory are made invisible. I do understand that this behaviour is consistent with mounting, so I know this is not technically an issue.
But I wonder if it would be possible to set up a volume, or an alternative solution, that:
I wonder if it would be possible to set up a volume, or an alternative solution, that
firstly cannot be edited on the host side,
That would be a data volume container (with docker create
on an image with a VOLUME
directive)
and secondly allows for the host directory contents to be merged with the container's directory?
Not that I know of. You would have to do some kind of copy on startup.