From 9ce2b2e893e06187d5ef33ac569550261804cb7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Bj=C3=B6rklund?= Date: Fri, 6 Oct 2017 01:39:38 +0200 Subject: [PATCH] Add documentation for new mount command (#4796) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The currently implementation uses sshfs (and FUSE) to mount. It would be possible to make a Windows version, using Dokan. Signed-off-by: Anders F Björklund --- machine/reference/mount.md | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 machine/reference/mount.md diff --git a/machine/reference/mount.md b/machine/reference/mount.md new file mode 100644 index 0000000000..43ca18f2a2 --- /dev/null +++ b/machine/reference/mount.md @@ -0,0 +1,49 @@ +--- +description: Mount directory from machine +keywords: machine, mount, subcommand +title: docker-machine mount +--- + +Mount directories from a machine to your local host, using `sshfs`. + +The notation is `machinename:/path/to/dir` for the argument; you can also supply an alternative mount point (default is the same dir path). + +## Example + +Consider the following example: + +```none +$ mkdir foo +$ docker-machine ssh dev mkdir foo +$ docker-machine mount dev:/home/docker/foo foo +$ touch foo/bar +$ docker-machine ssh dev ls foo +bar +``` + + +Now you can use the directory on the machine, for mounting into containers. +Any changes done in the local directory, will be reflected in the machine too. + +```none +$ docker run -v /home/docker/foo:/tmp/foo busybox ls /tmp/foo +bar +$ docker touch foo/baz +$ docker run -v /home/docker/foo:/tmp/foo busybox ls /tmp/foo +bar +baz +``` + +The files are actually being transferred using `sftp` (over an ssh connection), +so this program ("sftp") needs to be present on the machine - but it usually is. + + +To unmount the directory again, you can use the same options but the `-u` flag. +You can also call `fuserunmount` (or `fusermount -u`) commands directly. + +```none +$ docker-machine mount -u dev:/home/docker/foo foo +$ rmdir foo +``` +**Note that files are actually being stored on the machine, *not* on the host.** +So make sure to make a copy of any files you want to keep, before removing it!