You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/reference/compose-file/services.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2035,6 +2035,9 @@ The short syntax uses a single string with colon-separated values to specify a v
2035
2035
> platform it rejects Compose files which use relative host paths with an error. To avoid ambiguities
2036
2036
> with named volumes, relative paths should always begin with `.` or `..`.
2037
2037
2038
+
> [!NOTE]
2039
+
> 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`.
2040
+
2038
2041
#### Long syntax
2039
2042
2040
2043
The long form syntax lets you configure additional fields that can't be
@@ -2048,9 +2051,7 @@ expressed in the short form.
2048
2051
- `read_only`: Flag to set the volume as read-only.
2049
2052
- `bind`: Used to configure additional bind options:
2050
2053
- `propagation`: The propagation mode used for the bind.
2051
-
- `create_host_path`: Creates a directory at the source path on host if there is nothing present.
2052
-
Compose does nothing if there is something present at the path. This is automatically implied by short syntax
2053
-
for backward compatibility with `docker-compose` legacy.
2054
+
- `create_host_path`: Creates a directory at the source path on the host if it doesn't exist. Defaults to `true`.
2054
2055
- `selinux`: The SELinux re-labeling option `z` (shared) or `Z` (private)
2055
2056
- `volume`: Configures additional volume options:
2056
2057
- `nocopy`: Flag to disable copying of data from a container when a volume is created.
0 commit comments