Skip to content

Commit f2c64c1

Browse files
authored
Merge pull request docker#6241 from thaJeztah/deprecate_bind_nonrecursive
remove deprecated `bind-nonrecursive` option for `--mount`
2 parents 25f9587 + abfe4d4 commit f2c64c1

File tree

5 files changed

+24
-40
lines changed

5 files changed

+24
-40
lines changed

docs/deprecated.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ The following table provides an overview of the current status of deprecated fea
6363
| Removed | [`Container` and `ContainerConfig` fields in Image inspect](#container-and-containerconfig-fields-in-image-inspect) | v25.0 | v26.0 |
6464
| Removed | [Deprecate legacy API versions](#deprecate-legacy-api-versions) | v25.0 | v26.0 |
6565
| Removed | [Container short ID in network Aliases field](#container-short-id-in-network-aliases-field) | v25.0 | v26.0 |
66+
| Removed | [Mount `bind-nonrecursive` option](#mount-bind-nonrecursive-option) | v25.0 | v29.0 |
6667
| Removed | [IsAutomated field, and `is-automated` filter on `docker search`](#isautomated-field-and-is-automated-filter-on-docker-search) | v25.0 | v28.2 |
6768
| Removed | [logentries logging driver](#logentries-logging-driver) | v24.0 | v25.0 |
6869
| Removed | [OOM-score adjust for the daemon](#oom-score-adjust-for-the-daemon) | v24.0 | v25.0 |
@@ -381,6 +382,26 @@ A new field `DNSNames` containing the container name (if one was specified),
381382
the hostname, the network aliases, as well as the container short ID, has been
382383
introduced in v25.0 and should be used instead of the `Aliases` field.
383384

385+
### Mount `bind-nonrecursive` option
386+
387+
**Deprecated in Release: v25.0**
388+
**Removed In Release: v29.0**
389+
390+
The `bind-nonrecursive` option was replaced with the [`bind-recursive`]
391+
option (see [cli-4316], [cli-4671]). The option was still accepted, but
392+
printed a deprecation warning:
393+
394+
```console
395+
bind-nonrecursive is deprecated, use bind-recursive=disabled instead
396+
```
397+
398+
In the v29.0 release, this warning is removed, and returned as an error.
399+
Users should use the equivalent `bind-recursive=disabled` option instead.
400+
401+
[`bind-recursive`]: https://docs.docker.com/engine/storage/bind-mounts/#recursive-mounts
402+
[cli-4316]: https://github.com/docker/cli/pull/4316
403+
[cli-4671]: https://github.com/docker/cli/pull/4671
404+
384405
### IsAutomated field, and `is-automated` filter on `docker search`
385406

386407
**Deprecated in Release: v25.0**

docs/reference/commandline/service_create.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -455,20 +455,6 @@ The following options can only be used for bind mounts (`type=bind`):
455455
When the option is not specified, the default behavior correponds to setting <tt>enabled</tt>.
456456
</td>
457457
</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 />
463-
<br />
464-
A value is optional:<br />
465-
<br />
466-
<ul>
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>
469-
</ul>
470-
</td>
471-
</tr>
472458
</table>
473459

474460
##### Bind propagation

man/docker-run.1.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,6 @@ according to RFC4862.
479479
If set to `disabled`, submounts are not recursively bind-mounted.
480480
If set to `writable`, submounts are recursively bind-mounted but not made recursively read-only.
481481
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`.
484482

485483
Options specific to `volume`:
486484

opts/mount.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"github.com/docker/go-units"
1313
mounttypes "github.com/moby/moby/api/types/mount"
14-
"github.com/sirupsen/logrus"
1514
)
1615

1716
// MountOpt is a Value type for parsing mounts
@@ -88,8 +87,7 @@ func (m *MountOpt) Set(value string) error {
8887
volumeOptions().NoCopy = true
8988
continue
9089
case "bind-nonrecursive":
91-
bindOptions().NonRecursive = true
92-
continue
90+
return errors.New("bind-nonrecursive is deprecated, use bind-recursive=disabled instead")
9391
default:
9492
return fmt.Errorf("invalid field '%s' must be a key=value pair", field)
9593
}
@@ -117,16 +115,12 @@ func (m *MountOpt) Set(value string) error {
117115
case "bind-propagation":
118116
bindOptions().Propagation = mounttypes.Propagation(strings.ToLower(val))
119117
case "bind-nonrecursive":
120-
bindOptions().NonRecursive, err = strconv.ParseBool(val)
121-
if err != nil {
122-
return fmt.Errorf("invalid value for %s: %s", key, val)
123-
}
124-
logrus.Warn("bind-nonrecursive is deprecated, use bind-recursive=disabled instead")
118+
return errors.New("bind-nonrecursive is deprecated, use bind-recursive=disabled instead")
125119
case "bind-recursive":
126120
switch val {
127121
case "enabled": // read-only mounts are recursively read-only if Engine >= v25 && kernel >= v5.12, otherwise writable
128122
// NOP
129-
case "disabled": // alias of bind-nonrecursive=true
123+
case "disabled": // previously "bind-nonrecursive=true"
130124
bindOptions().NonRecursive = true
131125
case "writable": // conforms to the default read-only bind-mount of Docker v24; read-only mounts are recursively mounted but not recursively read-only
132126
bindOptions().ReadOnlyNonRecursive = true

opts/mount_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,6 @@ func TestMountOptSetTmpfsError(t *testing.T) {
259259
assert.ErrorContains(t, m.Set("type=tmpfs"), "target is required")
260260
}
261261

262-
func TestMountOptSetBindNonRecursive(t *testing.T) {
263-
var m MountOpt
264-
assert.NilError(t, m.Set("type=bind,source=/foo,target=/bar,bind-nonrecursive"))
265-
assert.Check(t, is.DeepEqual([]mount.Mount{
266-
{
267-
Type: mount.TypeBind,
268-
Source: "/foo",
269-
Target: "/bar",
270-
BindOptions: &mount.BindOptions{
271-
NonRecursive: true,
272-
},
273-
},
274-
}, m.Value()))
275-
}
276-
277262
func TestMountOptSetBindRecursive(t *testing.T) {
278263
t.Run("enabled", func(t *testing.T) {
279264
var m MountOpt

0 commit comments

Comments
 (0)