Bird
0
0

What happens if you run a container with user namespace remapping enabled and try to access a file owned by root on the host?

medium📝 Command Output Q5 of 15
Docker - Security

What happens if you run a container with user namespace remapping enabled and try to access a file owned by root on the host?

AThe container user is mapped to root on the host, so full access is granted
BThe container user remains root and can access all root-owned files on the host
CThe container cannot start due to permission errors
DThe container user is mapped to a non-root user, so root-owned files appear as owned by an unprivileged user
Step-by-Step Solution
Solution:
  1. Step 1: Understand user ID mapping with remapping

    User namespace remapping maps container root to an unprivileged host user ID.
  2. Step 2: Effect on file ownership visibility

    Root-owned files on host appear owned by the mapped unprivileged user inside container.
  3. Final Answer:

    The container user is mapped to a non-root user, so root-owned files appear as owned by an unprivileged user -> Option D
  4. Quick Check:

    Root remapped to unprivileged user = The container user is mapped to a non-root user, so root-owned files appear as owned by an unprivileged user [OK]
Quick Trick: Root in container maps to unprivileged user on host [OK]
Common Mistakes:
  • Assuming container root equals host root
  • Expecting container startup failure
  • Thinking container user maps to host root

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes