DCA practice question 6 of 25
Will this command mount the host's '/data' directory to the ubuntu container in read-only mode? Solution: 'docker run --volume /data:/mydata:ro ubuntu'
Full set: 191 questionsThe docker run command uses the --volume (or -v) flag to mount a host directory into a container. The syntax is host-src:container-dest:options. The provided command correctly specifies the host directory /data, the container directory /mydata, and the ro option. The ro option explicitly mounts the volume in read-only mode, preventing the container from writing to the host's /data directory.
B. No: This is incorrect. The command syntax is valid and the ro flag is the standard, officially documented method for creating a read-only volume mount.
1. Docker Docs, docker run command reference, "Mount volume (-v, --read-only)": "The -v or --volume flag takes a field with 3 fields, separated by colon characters (:). [host-src]:[container-dest]:[options]... The options are a comma-separated list, such as ro".
2. Docker Docs, "Use volumes", Section: "Use a read-only volume": "For some development workflows, you want the container to be able to write to the bind mount so that changes are propagated back to the Docker host. At other times, you want the container to only have read access. To mount a bind mount or volume as read-only, add :ro as an option at the end of the flag."
Keep practicing
Take the free DCA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DCA practice questions
- Question 1Does this command create a swarm service that only listens on port 53 using the UDP proto…
- Question 2Will this command ensure that overlay traffic between service tasks is encrypted? Solutio…
- Question 4Does this describe the role of Control Groups (cgroups) when used with a Docker container…
- Question 5Can this set of commands identify the published port(s) for a container? Solution: docker…
- Question 7A company's security policy specifies that development and production containers must run…
- Question 9Will this action upgrade Docker Engine CE to Docker Engine EE? Solution: Uninstall 'docke…
