Skip to content

Commit 74bace1

Browse files
committed
docs: add bind-recursive mount option
Follow-up to PR 4316 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
1 parent 8890a38 commit 74bace1

2 files changed

Lines changed: 38 additions & 11 deletions

File tree

docs/reference/commandline/service_create.md

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ volumes in a service:
394394
<td>
395395
<p>The Engine mounts binds and volumes <tt>read-write</tt> unless <tt>readonly</tt> option
396396
is given when mounting the bind or volume. Note that setting <tt>readonly</tt> for a
397-
bind-mount does not make its submounts <tt>readonly</tt> on the current Linux implementation. See also <tt>bind-nonrecursive</tt>.</p>
397+
bind-mount may not make its submounts <tt>readonly</tt> depending on the kernel version. See also <tt>bind-recursive</tt>.</p>
398398
<ul>
399399
<li><tt>true</tt> or <tt>1</tt> or no value: Mounts the bind or volume read-only.</li>
400400
<li><tt>false</tt> or <tt>0</tt>: Mounts the bind or volume read-write.</li>
@@ -432,17 +432,40 @@ The following options can only be used for bind mounts (`type=bind`):
432432
</td>
433433
</tr>
434434
<tr>
435-
<td><b>bind-nonrecursive</b></td>
435+
<td><b>bind-recursive</b></td>
436436
<td>
437437
By default, submounts are recursively bind-mounted as well. However, this behavior can be confusing when a
438-
bind mount is configured with <tt>readonly</tt> option, because submounts are not mounted as read-only.
439-
Set <tt>bind-nonrecursive</tt> to disable recursive bind-mount.<br />
438+
bind mount is configured with <tt>readonly</tt> option, because submounts may not be mounted as read-only,
439+
depending on the kernel version.
440+
Set <tt>bind-recursive</tt> to control the behavior of the recursive bind-mount.<br />
441+
<br />
442+
A value is one of:<br />
443+
<br />
444+
<ul>
445+
<li><<tt>enabled</tt>, <tt>true</tt> or <tt>1</tt>: Enables recursive bind-mount.
446+
Read-only mounts are made recursively read-only if kernel is v5.12 or later.
447+
Otherwise they are not made recursively read-only.</li>
448+
<li><<tt>disabled</tt>, <tt>false</tt> or <tt>0</tt>: Disables recursive bind-mount.</li>
449+
<li><<tt>writable</tt>: Enables recursive bind-mount.
450+
Read-only mounts are not made recursively read-only.</li>
451+
<li><<tt>readonly</tt>: Enables recursive bind-mount.
452+
Read-only mounts are made recursively read-only if kernel is v5.12 or later.
453+
Otherwise the Engine raises an error.</li>
454+
</ul>
455+
When the option is not specified, the default behavior correponds to setting <tt>enabled</tt>.
456+
</td>
457+
</tr>
458+
<tr>
459+
<td><b>bind-nonrecursive</b></td>
460+
<td>
461+
<tt>bind-nonrecursive</tt> is deprecated since Docker Engine v25.0.
462+
Use <tt>bind-recursive</tt>instead.<br />
440463
<br />
441464
A value is optional:<br />
442465
<br />
443466
<ul>
444-
<li><tt>true</tt> or <tt>1</tt>: Disables recursive bind-mount.</li>
445-
<li><tt>false</tt> or <tt>0</tt>: Default if you do not provide a value. Enables recursive bind-mount.</li>
467+
<li><tt>true</tt> or <tt>1</tt>: Equivalent to <tt>bind-recursive=disabled</tt>.</li>
468+
<li><tt>false</tt> or <tt>0</tt>: Equivalent to <tt>bind-recursive=enabled</tt>.</li>
446469
</ul>
447470
</td>
448471
</tr>

man/docker-run.1.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,20 @@ according to RFC4862.
467467
* `dst`, `destination`, `target`: mount destination spec.
468468
* `ro`, `readonly`: `true` or `false` (default).
469469

470-
**Note**: setting `readonly` for a bind mount does not make its submounts
471-
read-only on the current Linux implementation. See also `bind-nonrecursive`.
470+
**Note**: setting `readonly` for a bind mount may not make its submounts
471+
read-only depending on the kernel version. See also `bind-recursive`.
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.
477-
* `bind-nonrecursive`: `true` or `false` (default). If set to `true`,
478-
submounts are not recursively bind-mounted. This option is useful for
479-
`readonly` bind mount.
477+
* `bind-recursive`: `enabled` (default), `disabled`, `writable`, or `readonly`:
478+
If set to `enabled`, submounts are recursively bind-mounted and attempted to be made recursively read-only.
479+
If set to `disabled`, submounts are not recursively bind-mounted.
480+
If set to `writable`, submounts are recursively bind-mounted but not made recursively read-only.
481+
If set to `readonly`, submounts are recursively bind-mounted and forcibly made recursively read-only.
482+
* `bind-nonrecursive` (Deprecated): `true` or `false` (default). Setting `true` equates to `bind-recursive=disabled`.
483+
Setting `false` equates to `bind-recursive=enabled`.
480484

481485
Options specific to `volume`:
482486

0 commit comments

Comments
 (0)