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 -v /data:/mydata –mode readonly ubuntu’
A . Yes
B . No
Answer: B
Explanation:
= The command docker run -v /data:/mydata –mode readonly ubuntu is not valid because it has some syntax errors. The correct syntax for running a container with a bind mount is docker run [OPTIONS] IMAGE [COMMAND] [ARG…]. The errors in the command are:
The option flag for specifying the volume is –volume or -v, not -v. For example, -v /data:/mydata should be –volume /data:/mydata.
The option flag for specifying the mode of the volume is –mount, not –mode. For example, –mode readonly should be –mount type=bind,source=/data,target=/mydata,readonly.
The option flag for specifying the mode of the container is –detach or -d, not –mode. For example, — mode readonly should 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 the ubuntu image and mount the host’s /data directory to the container’s /mydata directory in read-only mode. The container will run in the background (– detach).
Reference: : docker run reference | Docker Documentation : [Use bind mounts | Docker Documentation]
Latest DCA Dumps Valid Version with 55 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund