Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions content/reference/compose-file/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -2035,6 +2035,9 @@ The short syntax uses a single string with colon-separated values to specify a v
> platform it rejects Compose files which use relative host paths with an error. To avoid ambiguities
> with named volumes, relative paths should always begin with `.` or `..`.

> [!NOTE]
> For bind mounts, short syntax creates a directory at the source path on the host if it doesn't exist. This is for backward compatibility with `docker-compose` legacy. It can be prevented by using long syntax and setting `create_host_path` to `false`.

#### Long syntax

The long form syntax lets you configure additional fields that can't be
Expand All @@ -2048,9 +2051,7 @@ expressed in the short form.
- `read_only`: Flag to set the volume as read-only.
- `bind`: Used to configure additional bind options:
- `propagation`: The propagation mode used for the bind.
- `create_host_path`: Creates a directory at the source path on host if there is nothing present.
Compose does nothing if there is something present at the path. This is automatically implied by short syntax
for backward compatibility with `docker-compose` legacy.
- `create_host_path`: Creates a directory at the source path on the host if it doesn't exist. Defaults to `true`.
- `selinux`: The SELinux re-labeling option `z` (shared) or `Z` (private)
- `volume`: Configures additional volume options:
- `nocopy`: Flag to disable copying of data from a container when a volume is created.
Expand Down