ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 53 - DCA discussion

Report
Export

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

Answers
A.

Yes

B.

No

Answers
B.

No

Suggested 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

asked 08/11/2024
Deshawn Sharpe
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first