Interview Prep/Docker/Volumes & Bind Mounts

Why do I get "permission denied" writing to a bind mount?

IntermediateConceptVolumes & Bind Mounts
Answer

UIDs are numeric and not translated by default: a container user with UID 1000 writes to a host directory owned by UID 1001 or root. Fix by matching UID/GID (--user $(id -u):$(id -g)), chown the host dir, or use userns-remap. On SELinux hosts add :z or :Z to relabel; on rootless Podman use :U or --userns=keep-id.

All Docker questions Roadmap: Docker & containers

More on Volumes & Bind Mounts