Bird
0
0

You start a container with --read-only and try to create a file in /tmp, but get a permission error. What is the most probable reason?

medium📝 Troubleshoot Q6 of 15
Docker - Security
You start a container with --read-only and try to create a file in /tmp, but get a permission error. What is the most probable reason?
A<code>/tmp</code> directory does not exist inside the container.
B<code>/tmp</code> is part of the read-only root filesystem and not mounted as writable.
CThe container is missing network access.
DThe Docker daemon is running in debug mode.
Step-by-Step Solution
Solution:
  1. Step 1: Understand --read-only

    The entire root filesystem is read-only, including /tmp, unless explicitly mounted writable.
  2. Step 2: Cause of permission error

    Trying to write to /tmp fails because it is not writable.
  3. Final Answer:

    /tmp is part of the read-only root filesystem and not mounted as writable. -> Option B
  4. Quick Check:

    Writable mounts needed for write access [OK]
Quick Trick: Writable mounts required for /tmp with --read-only [OK]
Common Mistakes:
  • Assuming /tmp is writable by default
  • Blaming network or daemon mode for permission errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes