0

I have a container that I start like

docker run -it --mount type=bind,source=/path/to/my/data,target=/staging -v myvol:/myvol buildandoid bash -l

It has two mounts, one bind mount that I use to get data into the container, and one named volume that I use to persist data. The container is used as a reproducable android (AOSP) build environment, so not your typical web service.

I would like to access the files on myvol from the Windows host. If I use an absolute path for the mount, e.g. -v /c/some/path:/myvol, I can do that, but I believe docker creates copies of all the files and keeps them in sync. I really want to avoid creating these files on the windows side (for space reasons, as it is several GB, and performance reasons, since NTFS doesn't seem to handle many little files well).

Can I somehow "mount" a container directory or a named volume on the host? So the exact reverse of a bind mount. I think alternatively I could install samba or sshd in the container, and use that, but maybe there is something built into docker / VirtualBox to achive this.

jdm
  • 9,470
  • 12
  • 58
  • 110

1 Answers1

0

Use bind mounts.

https://docs.docker.com/engine/admin/volumes/bind-mounts/

By contrast, when you use a volume, a new directory is created within Docker’s storage directory on the host machine, and Docker manages that directory’s contents.

Patrick Leijser
  • 210
  • 4
  • 11
  • With bind mounds, doesn't the data reside on the host? My data already exists on a filesystem in the container, and I want to expose this to the host without having a copy on the host. Keep in mind I am using windows, so this is not merely an linux container, but a VirtualBox VM. – jdm Jan 08 '18 at 17:00
  • https://www.digitalocean.com/community/tutorials/how-to-share-data-between-docker-containers – Patrick Leijser Jan 16 '18 at 07:22