UID/GID mapping
Rootless mode and userns-remap mode map container UIDs
and GIDs to the host differently.
- In
userns-remapmode, container UID0is mapped to the first subordinate UID listed in/etc/subuidfor the remap user, and container UIDnis mapped tosubuid + n. - In rootless mode, container UID
0is mapped to the host UID of the user running rootless Docker (the result ofid -u); container UIDn(forn >= 1) is mapped tosubuid + (n - 1).
GIDs follow the same rules using /etc/subgid.
This difference matters when setting file permissions on bind-mounted
directories: in rootless mode, files owned by your host user appear as owned
by root inside the container.