Skip to content

Commit

Permalink
Add docs for expanded mount syntax.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Nephin <[email protected]>
  • Loading branch information
dnephin committed Mar 13, 2017
1 parent 673de3b commit e51ff3e
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions compose/compose-file/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1060,11 +1060,14 @@ more information.
> [`volumes` option](#volume-configuration-reference) defines
> a named volume and references it from each service's `volumes` list. This replaces `volumes_from` in earlier versions of the Compose file format.
Mount paths or named volumes, optionally specifying a path on the host machine
(`HOST:CONTAINER`), or an access mode (`HOST:CONTAINER:ro`).
Named volumes must be defined in the
Mount host paths or named volumes. Named volumes must be defined in the
[top-level `volumes` key](#volume-configuration-reference).

#### Short syntax

Optionally specify a path on the host machine
(`HOST:CONTAINER`), or an access mode (`HOST:CONTAINER:ro`).

You can mount a relative path on the host, which will expand relative to
the directory of the Compose configuration file being used. Relative paths
should always begin with `.` or `..`.
Expand All @@ -1086,6 +1089,37 @@ should always begin with `.` or `..`.
- datavolume:/var/lib/mysql


#### Long syntax

The long form syntax allows the configuration of additional fields that can't be
expressed in the short form.

- `type`: the mount type `volume` or `bind`
- `source`: the source of the mount, a path on the host for a bind mount, or the
name of a volume defined in the
[top-level `volumes` key](#volume-configuration-reference)
- `target`: the path in the container where the volume will be mounted
- `read_only`: flag to set the volume as read-only
- `bind`: configure additional bind options
- `propagation`: the propagation mode used for the bind
- `volume`: configure additional volume options
- `nocopy`: flag to disable copying of data from a container when a volume is
created


```none
volumes:
- type: volume
source: mydata
target: /data
volume:
nocopy: true
- type: bind
source: ./static
target: /opt/app/static
```

> **Note:** The long syntax is new in v3.2
See [Docker Volumes](/engine/userguide/dockervolumes.md) and
[Volume Plugins](/engine/extend/plugins_volume.md) for more information.
Expand Down

0 comments on commit e51ff3e

Please sign in to comment.