I saw a comment asking if read-write or read-only was the default option; read-write is the default option. (making a post because I haven't enough rep to comment)
Per docker documentation, running the following:
docker run -d \ --name devtest \ --mount source=myvol2,target=/app \ nginx:latest
and then using docker inspect devtest and locating the "RW" option in the "Mounts" section of the output:
"Mounts": [ { "Type": "volume", "Source": "/var/lib/docker/volumes/myvol2/_data", "Destination": "/app", "Driver": "local", "Mode": "", "RW": true, "Propagation": "" } ],
lets us see that the default option lets the volume be both read- and write-able.
To set your volume as read-only (again per official documentation), add readonly after your source and destination tags:
docker run -d \ --name=nginxtest \ --mount source=nginx-vol,destination=/usr/share/nginx/html,readonly \ nginx:latest
Run docker inspect nginxtest and locate "Mounts":
"Mounts": [ { "Type": "volume", "Source": "/var/lib/docker/volumes/nginx-vol/_data", "Destination": "/usr/share/nginx/html", "Driver": "local", "Mode": "", "RW": false, "Propagation": "" } ],
(Note: I don't know why official documentation swaps between target and destination tags, but I am working under the assumption they can be used interchangeably.)
docker run -t -i \ -v '/on/my/host/test1:/on/the/container/test1' \ -v '/on/my/host/test2:/on/the/container/test2' \ ubuntu /bin/bash.