diff options
| author | Vincent Demeester <vincent@sbr.pm> | 2016-02-29 16:59:43 +0100 |
|---|---|---|
| committer | Vincent Demeester <vincent@sbr.pm> | 2016-02-29 16:59:43 +0100 |
| commit | 6c01d2a0cf4feb24bddf6830fd1683060c0ff309 (patch) | |
| tree | 27486482637c6b1c9f420db59b414a0d98eaacba /docs/userguide | |
| parent | eb22fcc229b364dd4429823c96b8f2e585e73217 (diff) | |
| parent | b6fdcd3a342dc882955253e0a39711ed4ac078fc (diff) | |
| download | docker-6c01d2a0cf4feb24bddf6830fd1683060c0ff309.tar.gz | |
Merge pull request #20629 from wallnerryan/intro-volumes
Intro volume drivers in dockervolumes.md
Diffstat (limited to 'docs/userguide')
| -rw-r--r-- | docs/userguide/containers/dockervolumes.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/userguide/containers/dockervolumes.md b/docs/userguide/containers/dockervolumes.md index 63d7e513d7..46602588f0 100644 --- a/docs/userguide/containers/dockervolumes.md +++ b/docs/userguide/containers/dockervolumes.md @@ -159,6 +159,48 @@ user with access to host and its mounted directory. >should be portable. A host directory wouldn't be available on all potential >hosts. +### Mount a shared-storage volume as a data volume + +In addition to mounting a host directory in your container, some Docker +[volume plugins](../../extend/plugins_volume.md) allow you to +provision and mount shared storage, such as iSCSI, NFS, or FC. + +A benefit of using shared volumes is that they are host-independent. This +means that a volume can be made available on any host that a container is +started on as long as it has access to the shared storage backend, and has +the plugin installed. + +One way to use volume drivers is through the `docker run` command. +Volume drivers create volumes by name, instead of by path like in +the other examples. + +The following command creates a named volume, called `my-named-volume`, +using the `flocker` volume driver, and makes it available within the container +at `/opt/webapp`: + +```bash +$ docker run -d -P \ + --volume-driver=flocker \ + -v my-named-volume:/opt/webapp \ + --name web training/webapp python app.py +``` + +You may also use the `docker volume create` command, to create a volume before +using it in a container. + +The following example also creates the `my-named-volume` volume, this time +using the `docker volume create` command. + +```bash +$ docker volume create -d flocker --name my-named-volume -o size=20GB +$ docker run -d -P \ + -v my-named-volume:/opt/webapp \ + --name web training/webapp python app.py +``` + +A list of available plugins, including volume plugins, is available +[here](../../extend/plugins.md). + ### Volume labels Labeling systems like SELinux require that proper labels are placed on volume |
