Original: http://my.oschina.net/piorcn/blog/324202
Docker can support mounting a directory on a host to a mirror
Docker Run-it-v/home/dock/downloads:/usr/downloads Ubuntu64/bin/bash
With the-v argument, the colon is preceded by a host directory, which must be an absolute path, followed by a colon after the path that is mounted inside the mirror.
The files in the host can now be shared within the image.
The default mount path permission is read-write. If specified as read-only can be used: RO
Docker Run-it-v/home/dock/downloads:/usr/downloads:ro Ubuntu64/bin/bash
Docker also provides a high level of usage. Called a data volume.
Data volume: "In fact, it is a normal container dedicated to providing data volumes for other containers to mount." It feels like a data-mount message defined by a container. Other container launches can be mounted directly to mount information defined in the data volume container.
See Example:
Docker run-v/home/dock/downloads:/usr/downloads --name datavol Ubuntu64/bin/bash
Create a common container. Use--name to give him a name (a random name is generated if you don't specify it).
Create a new container to use this data volume.
Docker run-it--volumes-from Datavol Ubuntu64/bin/bash
The--volumes-from is used to specify which data volume to mount data from.
Go: Docker Learning---mount a local directory