Description
When the Docker daemon uses userns-remap, userns_mode: host disables user ID remapping for this container.
Potential impact
A container user may have the same numeric identity on the host, giving it greater access to bind-mounted files than intended.
Remediation
Remove userns_mode: host unless the service requires an exception. Check the daemon’s userns-remap setting, the resulting UID/GID mappings and ownership of bind-mounted files. Keep debugging exceptions separate from production.
Examples
With the override removed, service1 inherits the daemon’s configuration. If you need user isolation, configure remapping or evaluate rootless Docker and test the image with its mounts.
Before
yaml
services:
service1:
image: service1:3.4
userns_mode: host
After
yaml
services:
service1:
image: service1:3.4