You want to make the volume read-only but accidentally write :ro as :or. What will happen?
medium
A. Docker will mount the volume as read-only anyway
B. Docker will throw an error and refuse to start the container
C. The volume will be mounted as read-write
D. The container will start but fail when writing to the volume
Solution
Step 1: Check the mount option syntax
The option :ro is valid for read-only. :or is invalid and not recognized by Docker.
Step 2: Understand Docker's response to invalid options
Docker will detect the invalid option and refuse to start the container, showing an error.
Final Answer:
Docker will throw an error and refuse to start the container -> Option B
Quick Check:
Invalid mount options cause Docker errors [OK]
Hint: Check option spelling carefully; invalid options cause errors [OK]
Common Mistakes:
Assuming Docker ignores invalid mount options
Thinking volume mounts as read-only despite typo
Believing container starts but fails later
5. You want to share a configuration directory /etc/config with multiple containers but prevent them from modifying it. Which command correctly mounts it read-only and ensures the container user cannot override this?
hard
A. docker run -v /etc/config:/config:ro myapp
B. docker run --read-only -v /etc/config:/config myapp
C. docker run -v /etc/config:/config:rw --user 1000 myapp
D. docker run -v /etc/config:/config:rw myapp
Solution
Step 1: Understand read-only volume mount
Mounting with :ro makes the volume read-only inside the container, preventing writes regardless of user.
Step 2: Evaluate other options
docker run --read-only -v /etc/config:/config myapp makes the entire container filesystem read-only, which is overly restrictive. docker run -v /etc/config:/config:rw --user 1000 myapp adds user but does not prevent writes since volume is read-write. docker run -v /etc/config:/config:rw myapp mounts read-write, allowing changes.
Final Answer:
docker run -v /etc/config:/config:ro myapp -> Option A
Quick Check:
Use :ro to share read-only volumes safely [OK]
Hint: Use ':ro' to protect shared data from container writes [OK]
Common Mistakes:
Confusing container read-only flag with volume read-only
Mounting volume as read-write by mistake
Thinking user ID affects volume write permissions
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.