@@ -468,15 +468,22 @@ according to RFC4862.
468468 * ` ro ` , ` readonly ` : ` true ` or ` false ` (default).
469469
470470 ** Note** : setting ` readonly ` for a bind mount does not make its submounts
471- read-only on the current Linux implementation. See also ` bind-nonrecursive ` .
471+ read-only if Docker Engine is older than v25, or Linux kernel is older than v5.12. See also ` bind ` options below .
472472
473473 Options specific to ` bind ` :
474474
475475 * ` bind-propagation ` : ` shared ` , ` slave ` , ` private ` , ` rshared ` , ` rslave ` , or ` rprivate ` (default). See also ` mount(2) ` .
476476 * ` consistency ` : ` consistent ` (default), ` cached ` , or ` delegated ` . Currently, only effective for Docker for Mac.
477477 * ` bind-nonrecursive ` : ` true ` or ` false ` (default). If set to ` true ` ,
478478 submounts are not recursively bind-mounted. This option is useful for
479- ` readonly ` bind mount.
479+ ` readonly ` bind mount when running on Linux kernel older than v5.12, which leaves submounts writable.
480+ * ` bind-ro-nonrecursive ` , ` bind-readonly-nonrecursive ` : ` true ` or ` false ` (default). If set to ` true ` ,
481+ submounts are recursively bind-mounted (unless ` bind-nonrecursive ` is set to ` true ` in conjunction),
482+ but they are not recursively made read-only. This corresponds to the default behavior of Docker Engine v24 and older.
483+ A ` false ` value is ignored when the Docker daemon is running on Linux kernel older than v5.12.
484+ * ` bind-ro-forcerecursive ` ,` bind-readonly-forcerecursive ` : ` true ` or ` false ` (default). If set to ` true ` ,
485+ and submounts cannot be made recursively read-only, the Docker daemon raises an error.
486+ This option should be used in conjunction with ` bind-propagation=rprivate ` .
480487
481488 Options specific to ` volume ` :
482489
@@ -719,7 +726,7 @@ any options, the systems uses the following options:
719726 container. If 'HOST-DIR' is omitted, Docker automatically creates the new
720727 volume on the host. The ` OPTIONS ` are a comma delimited list and can be:
721728
722- * [ rw|ro]
729+ * [ rw|ro|ro-non-recursive|ro-force-recursive|rro ]
723730 * [ z|Z]
724731 * [ ` [r]shared ` |` [r]slave ` |` [r]private ` ]
725732 * [ ` delegated ` |` cached ` |` consistent ` ]
@@ -747,6 +754,14 @@ You can also specify the consistency requirement for the mount, either
747754` :consistent ` (the default), ` :cached ` , or ` :delegated ` . Multiple options are
748755separated by commas, e.g. ` :ro,cached ` .
749756
757+ Starting with Docker Engine v25, the ` :ro ` mode makes its submounts read-only when running on
758+ Linux kernel v5.12 or newer.
759+ To fall back to the behavior of Docker Engine v24, specify ` :ro-non-recursive ` .
760+ To explicitly make the mount recursively read-only, specify ` :ro-force-recursive `
761+ or ` :rro ` .
762+ The ` :ro-force-recursive ` (` :rro ` ) mode should be used in conjunction with ` bind-propagation=rprivate ` .
763+ The ` :ro-force-recursive ` (` :rro ` ) mode fails when running on Linux kernel older than v5.12.
764+
750765Labeling systems like SELinux require that proper labels are placed on volume
751766content mounted into a container. Without a label, the security system might
752767prevent the processes running inside the container from using the content. By
0 commit comments