ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 52 - DCA discussion

Report
Export

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'

A.

Yes

Answers
A.

Yes

B.

No

Answers
B.

No

Suggested answer: B

Explanation:

= The commanddocker run -v /data:/mydata --mode readonly ubuntuisnot validbecause it has somesyntax errors. The correct syntax for running a container with a bind mount isdocker run [OPTIONS] IMAGE [COMMAND] [ARG...]. The errors in the command are:

The option flag for specifying thevolumeis--volumeor-v, not-v. For example,-v /data:/mydatashould be--volume /data:/mydata.

The option flag for specifying themodeof the volume is--mount, not--mode. For example,--mode readonlyshould be--mount type=bind,source=/data,target=/mydata,readonly.

The option flag for specifying themodeof the container is--detachor-d, not--mode. For example,--mode readonlyshould be--detach.

The correct command for running a container with a bind mount in read-only mode is:

docker run --volume /data:/mydata --mount type=bind,source=/data,target=/mydata,readonly --detach ubuntu

This command will run a container using theubuntuimage and mount the host's/datadirectory to the container's/mydatadirectory in read-only mode. The container will run in the background (--detach).

asked 08/11/2024
Karsten Heimers
41 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first