mirror of
https://github.com/docker/docs.git
synced 2026-03-28 14:58:53 +07:00
* Reword lots of instances of 'will' * Reword lots of instances of won't * Reword lots of instances of we'll * Eradicate you'll * Eradicate 'be able to' type of phrases * Eradicate 'unable to' type of phrases * Eradicate 'has / have to' type of phrases * Eradicate 'note that' type of phrases * Eradicate 'in order to' type of phrases * Redirect to official Chef and Puppet docs * Eradicate gratuitous 'please' * Reduce use of e.g. * Reduce use of i.e. * Reduce use of N.B. * Get rid of 'sexagesimal' and correct some errors
51 lines
1.4 KiB
Markdown
51 lines
1.4 KiB
Markdown
---
|
|
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, is reflected in the machine too.
|
|
|
|
```none
|
|
$ eval $(docker-machine env dev)
|
|
$ docker run -v /home/docker/foo:/tmp/foo busybox ls /tmp/foo
|
|
bar
|
|
$ 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
|
|
```
|
|
**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!
|