What is a Linux user namespace, and how does it make a container's root user safer?
A namespace that maps user and group IDs so that UID 0 (root) inside the container is an ordinary, unprivileged high UID on the host — root in the container is not root on the host.
Namespaces isolate a process's view of system resources without the process being aware of it. The user namespace specifically remaps UIDs and GIDs across the container boundary.
Normally a process running as root (UID 0) inside a container is also UID 0 on the host — so a container escape lands the attacker as real root. With a user namespace enabled (userns-remap), the kernel maps the container's UID range onto a block of unprivileged host UIDs. For example, container UID 0 becomes host UID 231072, with the next 65536 IDs reserved for the container (recorded in /etc/subuid and /etc/subgid).
The payoff: if an attacker who is root inside the container breaks out, on the host they are a high, fictitious UID that is not even a real user and owns nothing — so they have no privileges on the host. It directly defeats the volume-mount and similar privilege-escalation tricks, because files the container "root" touches are owned by that harmless remapped UID.
Docker's --userns-remap=default creates the user dockremap automatically to anchor the mapping.
Go deeper:
Docker: User Namespaces, Phil Estes — a clear walkthrough of how UID remapping isolates container root.
man7.org: user_namespaces(7) — the authoritative reference on UID/GID mapping.
Wikipedia: Linux namespaces — all seven namespace types and what each isolates.