3

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:

  • firstly cannot be edited on the host side,
  • and secondly allows for the host directory contents to be merged with the container's directory?
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
User588233
  • 481
  • 2
  • 5
  • 16

1 Answers1

1

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • That's what I suspected, I just needed some clarification - incase there was some sort of update that I wasn't aware of! – User588233 Dec 16 '15 at 14:45