nerdexam
Docker

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.

Submitted by jaden.t· Apr 18, 2026Storage and Volumes

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)
  • A
    90% (36)
  • B
    10% (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.

AYesCorrect

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.

BNo

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

#docker volumes#read-only mounts#docker run command

Community Discussion

No community discussion yet for this question.

Full DCA Practice