0

I'm trying to make a Docker image that logs onto a Kerio VPN and then mounts a remote samba directory onto /mnt.

The mounting is done using mount -t cifs -o username=USER,password=PWD //ABC/randomDirectory /mnt and it succeeds. When I list the contents of /mnt from the container itself I can see all the files and directories on the remote server, but when I list the host directory that has been mounted on the container when starting it (-v /absolute/path/to/mountpoint:/mnt), it comes up empty.

I tried adding a simple touch /mnt/test on the start of the ENTRYPOINT script, and that creates a file in /absolute/path/to/mountpoint and is even there when I list it from inside the container. Once I mount the CIFS, listing from inside the container provides all the files and directories on the remote, and listing from the host shows only the created test file.

It seems like the mount command inside the container "detaches" the docker volume.

EDIT: mounting to a subdirectory in the mounted volume doesn't work either

freemanovec
  • 17
  • 2
  • 8
  • 1
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww May 26 '18 at 21:08
  • @jww Yeah, because DEVELOPING a Docker image is not development, right.. – freemanovec May 27 '18 at 04:53
  • @jww But that was actually useful xD Found this: https://unix.stackexchange.com/questions/292999/mounting-a-nfs-directory-into-host-volume-that-is-shared-with-docker – freemanovec May 27 '18 at 05:00

1 Answers1

-1

The volume can be specified to mount as shared by -v /local/path:/mnt:shared

freemanovec
  • 17
  • 2
  • 8