Is there any relationship between mounting volume with docker run -v
command and Dockerfile's VOLUME
instruction?
The -v
option can be used to bind a directory on the host to the container, but the VOLUME
instruction cannot. Other than that they are two different ways for making a volume available in the container.
Both instructions create a mount point in the container, but only -v
can actually mount anything there.
See:
http://docs.docker.com/engine/reference/builder/#volume and
http://docs.docker.com/engine/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume
for more in-depth descriptions of what both do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With