Read-only checks
Rootless Docker and userns-remap: trace the real host ID
A high-numbered host owner such as 232071 is not automatically a bad chmod or a broken image. Rootless Docker and userns-remap can translate a container UID into a different host UID. Read the active map first; changing permissions cannot correct an identity mapping you have not identified.
1. Confirm which Docker daemon you are using
docker context show
docker info --format '{{json .SecurityOptions}}'
grep -n '"userns-remap"' /etc/docker/daemon.json 2>/dev/null
A rootless daemon reports rootless in its security options. A system daemon using userns-remap commonly reports name=userns; its daemon configuration identifies the remap user. Checking the context matters when the same host has both a system daemon and a rootless daemon.
2. Compare the identities and active namespace maps
id
stat -c "%u:%g %a %n" /srv/shared
docker exec container_name id
docker exec container_name stat -c "%u:%g %a %n" /data1
docker exec container_name cat /proc/self/uid_map
docker exec container_name cat /proc/self/gid_map
Each map row contains the starting ID inside the container, the corresponding starting ID on the host, and the length of that range. Treat /proc/self/uid_map and /proc/self/gid_map as the active mapping; /etc/subuid and /etc/subgid show the ranges assigned on the host.
3. Interpret the common one-range mappings
| Docker mode |
Container UID 0 appears on the host as |
Container UID n appears on the host as |
System Docker daemon running as root, without userns-remap |
UID 0 |
UID n |
userns-remap, subordinate range starts at S |
S |
S + n |
Rootless Docker, daemon user is H, subordinate range starts at S |
Host UID H |
S + (n - 1) for n >= 1 |
For example, if the rootless daemon user is host UID 1000 and its subordinate range starts at 231072, container UID 0 maps to host UID 1000, while container UID 1000 maps to host UID 232071. In that setup, setting PUID=1000 does not make the process write as host UID 1000.
4. Check the assigned subordinate ranges
id -un
awk -F: -v name="$(id -un)" -v uid="$(id -u)" '$1 == name || $1 == uid' /etc/subuid
awk -F: -v name="$(id -un)" -v uid="$(id -u)" '$1 == name || $1 == uid' /etc/subgid
# For userns-remap, replace REMAP_USER with the daemon's configured remap user:
grep "^REMAP_USER:" /etc/subuid
grep "^REMAP_USER:" /etc/subgid
For userns-remap, check the daemon's userns-remap setting to identify the remap user. Docker commonly creates dockremap when the setting is default, but the configured name can be different.
5. Stop before recursive ownership changes
- Do not run
chown -R until you know which host identity the container actually uses. A recursive change can lock the host user or another service out of the same directory.
- Podman's
:U mount option is not a Docker bind-mount option. Podman documents that it recursively changes the source volume owner and group, so do not copy that fix into a Docker setup without understanding the host-side change.
- On NFS and CIFS mounts, the file server and mount options can decide the effective identity. A local ownership change may fail or may not change what the server authorizes.
- After any intentional fix, create a test file from inside the container and inspect its numeric owner on the host. That verifies the application path and the mapped process identity together.