Docker run -v <dir> vs Dockerfile VOLUME <dir>

Is there a connection between the installation volume with the docker run -v command and the Dockerfile VOLUME command?

+5
source share
1 answer

The -v option can be used to bind the directory on the host to the container, but the VOLUME instruction cannot. In addition, these are two different ways to make available volume in a container.

Both instructions create a mount point in the container, but only -v can actually mount something there.

Cm:
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 detailed descriptions of what both do.

+4
source

Source: https://habr.com/ru/post/1235738/


All Articles