docker build with volume code example
Example 1: docker mount volume
docker run -v /host/directory:/container/directory -other -options image_name command_to_run
Example 2: docker create volume
$ docker volume create hello
hello
$ docker run -d -v hello:/world busybox ls /world
Example 3: docker build mount volume
$ docker run -it -v "$(pwd)/source_dir:/app/target_dir" ubuntu bash
# OR
$ docker run -it --mount "type=bind,source=$(pwd)/source_dir,target=/app/target_dir" ubuntu bash