Description
Linux bind propagation controls which new mounts appear across a bind mount. shared propagates in both directions and slave from host to container. rshared and rslave apply those rules to nested mounts too.
Potential impact
A new mount can expose data to other containers. With bidirectional propagation, a container allowed to change mounts can also affect the host.
Remediation
Keep the default rprivate unless the service needs propagation. If it does, check the direction, nested mounts and sharing peers, limit who can change mounts, and test access. Docker Desktop does not support mount propagation.
Examples
Use your image and set ENVVAR to the base directory. Verify that the expanded host path $ENVVAR/.whew/path/datapath, mounted at /data, supports the chosen propagation.
Before
version: "3.2"
services:
app:
image: notreal
volumes:
- type: bind
source: $ENVVAR/.whew/path/datapath
target: /data
bind:
propagation: rshared
After
version: "3.2"
services:
app:
image: notreal
volumes:
- type: bind
source: $ENVVAR/.whew/path/datapath
target: /data
bind:
propagation: private
The example switches from rshared to private, which blocks propagation for this mount. Use rprivate to include nested mounts. Set file read and write permissions separately.