Example of a Docker bind mount.
Create an example directory and copy the following script to it. Make it executable and then run it.
$ chmod +x demo.sh
$ ./demo.sh
.
.
.
hello world
The last line of the script demonstrates using a bind mount. The source directory ("$PWD"/src
) is
mounted so that its contents are accessible to a running container under the target directory (/src
).
This is useful for dev containers where you want to build things without copying the entire local file system for the Docker build context.