I'm trying to dockerize some services for development on my machine and wondering how docker run --volume=..
works. For example, if I do something like
docker run --volume=/path/to/data:/data [...]
will /path/to/data
be (re)created locally only if it doesn't exist? Is the initial data copied from the container's image?
Links to relevant documentation would be appreciated.
The --volume
option is described in the docker run
reference docs, which forwards you on to the dedicated Managed data in containers docs, which then forwards you on to the Bind mounts docs.
There, it says:
If you use
-v
or--volume
to bind-mount a file or directory that does not yet exist on the Docker host,-v
will create the endpoint for you. It is always created as a directory.