Skip to content

Support bind-recursive option for bind mounts #11792

Description

@soylent-grin

Description

Since Docker 25.0.0, the way recursive bind mounts are handled was changed:

In earlier versions of Docker Engine, recursive mounts (submounts) would always be mounted as writable, even when specifying a read-only mount. This behavior has changed in v25.0.0, for hosts running on kernel version 5.12 or later. Now, read-only bind mounts are recursively read-only by default.
To get the same behavior as earlier releases, you can specify the bind-recursive option for the --mount flag.

docker run --mount type=bind,src=SRC,dst=DST,readonly,bind-recursive=writable IMAGE

More on recursive mounts: https://docs.docker.com/storage/bind-mounts/#recursive-mounts

Seems like this is not supported in Compose yet. Would be nice to have something like:

    volumes:
      - type: bind
        source: /mnt
        target: /mnt
        read_only: true
        bind:
          recursive: writable

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions