Will this command mount the host’s ‘/data’ directory to the ubuntu container in read-only mode?

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’
A . Yes
B . No

Answer: A

Explanation:

= The command ‘docker run –volume /data:/mydata:ro ubuntu’ will mount the host’s ‘/data’ directory to the ubuntu container in read-only mode. The –volume or -v option allows you to mount a host directory or a file to a container as a volume1. The syntax for this option is:

-v|–volume=[host-src:]container-dest[:<options>]

The host-src can be an absolute path or a name value. The container-dest must be an absolute path. The options can be a comma-separated list of mount options, such as ro for read-only, rw for read-write, z or Z for SELinux labels, etc1. In this case, the host-src is /data, the container-dest is /mydata, and the option is ro, which means the container can only read the data from the volume, but not write to it2. This can be useful for sharing configuration files or other data that should not be modified by the container3.

Reference: Use volumes | Docker Documentation

Docker run reference | Docker Documentation

Docker – Volumes – Tutorialspoint

Latest DCA Dumps Valid Version with 55 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments