nerdexam
Docker

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.

Submitted by naveen.iyer· 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 --add-volume /data /mydata -read-only ubuntu'

Options

  • AYes
  • BNo

How the community answered

(17 responses)
  • A
    24% (4)
  • B
    76% (13)

Why each option

The provided `docker run` command uses incorrect flags for specifying a volume mount and read-only mode.

AYes

The command uses non-existent flags (`--add-volume`, `-read-only`) for configuring volume mounts and read-only access in Docker.

BNoCorrect

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

#Docker Volumes#Volume Mounting#Read-only Mounts#docker run command

Community Discussion

No community discussion yet for this question.

Full DCA Practice