-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Description
Remote Shared Volumes
Currently we use volumes with -v
You have either regular volumes -v /container/some/path to put some folder in a volume, stored in /var/lib/docker and shared volumes -v /host/some/path:/container/some/path that use bind-mount to share some folder from your host to your container.
You can prepend :ro or :rw to set the mode.
Obviously bind mount can't work on a remote machine, so if your client is on OSX and your daemon on boot2docker, -v /host/some/path:/container/some/path will look for /host/some/path on the boot2docker host, not you mac.
Proposal
Add a driver to the volumes to specify how to handle the shared volumes.
We would have 2 drivers for now:
-
mountas it is today:-v mount:/host/some/path:/container/some/path
-
fusea new drive that uses fuse to share your volumes remotely:-v fuse:/host/some/path:/container/some/path
Note: if you do don't specify any driver, docker will try mount and if it cannot find the host folder, it'll default to fuse
To minimise the changes, for fuse we will create the fuse connection in /var/lib/docker/fuse/{fuseid} and then bind mount /var/lib/docker/fuse/{fuseid} inside the container as we do today.
Implementation
To not have any issue with firewall or complicated network setup the server has to instantiate the connection.
In /container/{name:.*}/start the daemon will create the fuse connection, associate this connection with a fuseId and return this fuseId
Then the client will call /fuse/attach/{fuseId}, the daemon will hijack the connection connect both ends together.
Dependencies
Regarding the code, github.com/hanwen/go-fuse, code.google.com/p/goprotobuf and pkg/vfuse made by @bradfitz will be added.
Regarding the runtime there is no new dependency.
POC
You can look here for a POC https://github.com/bradfitz/docker/commit/3b914114776147eb12402a58bb9f33d7f60e69bd