DCA · Question #94
Will this command mount the host's '/data' directory to the ubuntu container in read-only mode? Solution: 'docker run --add-volume /data /mydata -read-only ubuntu'
The correct answer is B. No. The provided docker run command uses incorrect flags for specifying a volume mount and read-only mode.
Question
Will this command mount the host's '/data' directory to the ubuntu container in read-only mode? Solution: 'docker run --add-volume /data /mydata -read-only ubuntu'
Options
- AYes
- BNo
How the community answered
(17 responses)- A24% (4)
- B76% (13)
Why each option
The provided `docker run` command uses incorrect flags for specifying a volume mount and read-only mode.
The command uses non-existent flags (`--add-volume`, `-read-only`) for configuring volume mounts and read-only access in Docker.
The flags `--add-volume` and `-read-only` are not valid `docker run` options for mounting volumes or setting read-only mode. The correct flag for mounting a volume is `-v` or `--volume`, and for read-only mode, it's `:ro` appended to the volume specification or `--read-only` for the container's entire filesystem.
Concept tested: Docker volume mount syntax
Source: https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-v---mount
Topics
Community Discussion
No community discussion yet for this question.