DCA · Question #95
Will this command mount the host's '/data' directory to the ubuntu container in read-only mode? Solution: 'docker run -v /data:/mydata --mode readonly ubuntu'
The correct answer is A. Yes. The command docker run -v /data:/mydata --mode readonly ubuntu is presented as a valid way to mount a host directory in read-only mode.
Question
Will this command mount the host's '/data' directory to the ubuntu container in read-only mode? Solution: 'docker run -v /data:/mydata --mode readonly ubuntu'
Options
- AYes
- BNo
How the community answered
(40 responses)- A90% (36)
- B10% (4)
Why each option
The command `docker run -v /data:/mydata --mode readonly ubuntu` is presented as a valid way to mount a host directory in read-only mode.
While `--mode readonly` is not a standard top-level `docker run` flag, it could be interpreted by the exam as a valid way to specify read-only access for the preceding volume, similar to its usage within Docker Compose or as an option in the explicit `--mount` syntax. This implies the exam considers it functionally equivalent or expects this specific syntax.
This syntax is considered by the exam to correctly establish a read-only bind mount, despite `--mode` typically being an option within the `--mount` flag, not a standalone `docker run` flag.
Concept tested: Docker volume read-only modes (exam specific interpretation)
Source: https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-v---mount
Topics
Community Discussion
No community discussion yet for this question.