dockerfile 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 ARG

$ docker build --build-arg some_variable_name=a_value

Example 3: docker create volume

$ docker volume create hello

hello

$ docker run -d -v hello:/world busybox ls /world

Example 4: docker create volume

docker volume create [OPTIONS] [VOLUME]

Example 5: docker volumes copy content

CID=$(docker run -d -v hello:/hello busybox true)
docker cp $CID:/hello ./