In the short syntax source:target:mode
the official documentation only mentions ro
and rw
but in the cookiecutter template for django they are using other two modes: z
and Z
, I didn't find any reference for them anywhere, What are they?
Asked
Active
Viewed 8,633 times
3

Mohamed Abdultawab
- 46
- 1
- 6
1 Answers
4
The Docker run reference documents:
-v, --volume=[host-src:]container-dest[:<options>]: Bind mount a volume.
The comma-delimited `options` are [rw|ro], [z|Z],
[[r]shared|[r]slave|[r]private], and [nocopy].
The 'host-src' is an absolute path or a name value.
If neither 'rw' or 'ro' is specified then the volume is mounted in
read-write mode.
The `nocopy` mode is used to disable automatically copying the requested volume
path in the container to the volume storage location.
For named volumes, `copy` is the default mode. Copy modes are not supported
for bind-mounted volumes.
These options are further documented in the (named) volume documentation (specifically ro
) and bind mount documentation.
In practice I never need any of these options, except if I happen to be deploying to a system with SELinux enabled, then z
is useful.

David Maze
- 130,717
- 29
- 175
- 215
-
2The specific documentation for "z" and "Z" is here: https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label – markshep Aug 30 '22 at 18:29