remove deprecated bind-nonrecursive option for --mount

The `bind-nonrecursive` option was replaced with the [`bind-recursive`]
option (see [cli-4316], [cli-4671]). The option was still accepted, but
printed a deprecation warning:

    bind-nonrecursive is deprecated, use bind-recursive=disabled instead

In the v29.0 release, this warning is removed, and returned as an error.
Users should use the equivalent `bind-recursive=disabled` option instead.

[`bind-recursive`]: https://docs.docker.com/engine/storage/bind-mounts/#recursive-mounts
[cli-4316]: https://github.com/docker/cli/pull/4316
[cli-4671]: https://github.com/docker/cli/pull/4671

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-08-05 23:23:38 +02:00
parent b01d359cc9
commit abfe4d4629
5 changed files with 24 additions and 40 deletions
+21
View File
@@ -63,6 +63,7 @@ The following table provides an overview of the current status of deprecated fea
| Removed | [`Container` and `ContainerConfig` fields in Image inspect](#container-and-containerconfig-fields-in-image-inspect) | v25.0 | v26.0 |
| Removed | [Deprecate legacy API versions](#deprecate-legacy-api-versions) | v25.0 | v26.0 |
| Removed | [Container short ID in network Aliases field](#container-short-id-in-network-aliases-field) | v25.0 | v26.0 |
| Removed | [Mount `bind-nonrecursive` option](#mount-bind-nonrecursive-option) | v25.0 | v29.0 |
| Removed | [IsAutomated field, and `is-automated` filter on `docker search`](#isautomated-field-and-is-automated-filter-on-docker-search) | v25.0 | v28.2 |
| Removed | [logentries logging driver](#logentries-logging-driver) | v24.0 | v25.0 |
| 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),
the hostname, the network aliases, as well as the container short ID, has been
introduced in v25.0 and should be used instead of the `Aliases` field.
### Mount `bind-nonrecursive` option
**Deprecated in Release: v25.0**
**Removed In Release: v29.0**
The `bind-nonrecursive` option was replaced with the [`bind-recursive`]
option (see [cli-4316], [cli-4671]). The option was still accepted, but
printed a deprecation warning:
```console
bind-nonrecursive is deprecated, use bind-recursive=disabled instead
```
In the v29.0 release, this warning is removed, and returned as an error.
Users should use the equivalent `bind-recursive=disabled` option instead.
[`bind-recursive`]: https://docs.docker.com/engine/storage/bind-mounts/#recursive-mounts
[cli-4316]: https://github.com/docker/cli/pull/4316
[cli-4671]: https://github.com/docker/cli/pull/4671
### IsAutomated field, and `is-automated` filter on `docker search`
**Deprecated in Release: v25.0**
@@ -455,20 +455,6 @@ The following options can only be used for bind mounts (`type=bind`):
When the option is not specified, the default behavior correponds to setting <tt>enabled</tt>.
</td>
</tr>
<tr>
<td><b>bind-nonrecursive</b></td>
<td>
<tt>bind-nonrecursive</tt> is deprecated since Docker Engine v25.0.
Use <tt>bind-recursive</tt>instead.<br />
<br />
A value is optional:<br />
<br />
<ul>
<li><tt>true</tt> or <tt>1</tt>: Equivalent to <tt>bind-recursive=disabled</tt>.</li>
<li><tt>false</tt> or <tt>0</tt>: Equivalent to <tt>bind-recursive=enabled</tt>.</li>
</ul>
</td>
</tr>
</table>
##### Bind propagation
-2
View File
@@ -479,8 +479,6 @@ according to RFC4862.
If set to `disabled`, submounts are not recursively bind-mounted.
If set to `writable`, submounts are recursively bind-mounted but not made recursively read-only.
If set to `readonly`, submounts are recursively bind-mounted and forcibly made recursively read-only.
* `bind-nonrecursive` (Deprecated): `true` or `false` (default). Setting `true` equates to `bind-recursive=disabled`.
Setting `false` equates to `bind-recursive=enabled`.
Options specific to `volume`:
+3 -9
View File
@@ -11,7 +11,6 @@ import (
"github.com/docker/go-units"
mounttypes "github.com/moby/moby/api/types/mount"
"github.com/sirupsen/logrus"
)
// MountOpt is a Value type for parsing mounts
@@ -88,8 +87,7 @@ func (m *MountOpt) Set(value string) error {
volumeOptions().NoCopy = true
continue
case "bind-nonrecursive":
bindOptions().NonRecursive = true
continue
return errors.New("bind-nonrecursive is deprecated, use bind-recursive=disabled instead")
default:
return fmt.Errorf("invalid field '%s' must be a key=value pair", field)
}
@@ -117,16 +115,12 @@ func (m *MountOpt) Set(value string) error {
case "bind-propagation":
bindOptions().Propagation = mounttypes.Propagation(strings.ToLower(val))
case "bind-nonrecursive":
bindOptions().NonRecursive, err = strconv.ParseBool(val)
if err != nil {
return fmt.Errorf("invalid value for %s: %s", key, val)
}
logrus.Warn("bind-nonrecursive is deprecated, use bind-recursive=disabled instead")
return errors.New("bind-nonrecursive is deprecated, use bind-recursive=disabled instead")
case "bind-recursive":
switch val {
case "enabled": // read-only mounts are recursively read-only if Engine >= v25 && kernel >= v5.12, otherwise writable
// NOP
case "disabled": // alias of bind-nonrecursive=true
case "disabled": // previously "bind-nonrecursive=true"
bindOptions().NonRecursive = true
case "writable": // conforms to the default read-only bind-mount of Docker v24; read-only mounts are recursively mounted but not recursively read-only
bindOptions().ReadOnlyNonRecursive = true
-15
View File
@@ -259,21 +259,6 @@ func TestMountOptSetTmpfsError(t *testing.T) {
assert.ErrorContains(t, m.Set("type=tmpfs"), "target is required")
}
func TestMountOptSetBindNonRecursive(t *testing.T) {
var m MountOpt
assert.NilError(t, m.Set("type=bind,source=/foo,target=/bar,bind-nonrecursive"))
assert.Check(t, is.DeepEqual([]mount.Mount{
{
Type: mount.TypeBind,
Source: "/foo",
Target: "/bar",
BindOptions: &mount.BindOptions{
NonRecursive: true,
},
},
}, m.Value()))
}
func TestMountOptSetBindRecursive(t *testing.T) {
t.Run("enabled", func(t *testing.T) {
var m MountOpt