July 2017
Beginner to intermediate
358 pages
10h 54m
English
The -v, or --volume parameter allows you to specify a pair of values corresponding to the file system you wish to mount on the host and the path where you would like to mount the volume inside the container.
Let's try our example from earlier, but this time mounting a volume on the local file system:
$ docker run -it -v $(pwd):/host alpine:latest /bin/sh
If you change into the host folder, you will see that there is access to the same folder from where you ran the docker run command. The syntax for the values for -v is hostfolder:destinationfolder, one thing I think is important to point out is that these paths need to be absolute, and you cannot use a relative path like ./ or ../foldername. The volume you have just mounted ...
Read now
Unlock full access