I've done a search for site:stackoverflow.com docker: can volume be mounted?
and surely there are a number of posts found about how to do that. However, I'm concerned with IMHO internal contradiction in currently posted on web docker docs (they each do not give you postal date) and ask who knows for sure which is current correct way to say thing and where the docker evolution path leads:
https://docs.docker.com/storage/bind-mounts/:
Bind mounts have been around since the early days of Docker. Bind mounts have limited functionality compared to volumes.
https://docs.docker.com/storage/volumes/
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure of the host machine, volumes are completely managed by Docker.
https://docs.docker.com/engine/reference/run/
-v, --volume=[host-src:]container-dest[:]: Bind mount a volume.
Confusion comes from 3rd quote, "bind mount a volume", when two links above it try to separate bind mounts
from volumes
.
Confusion is aggravated by the fact than both --volume
and --mount
parameters to run
can be used for both bind mounts
and volumes
(and tmpfs
btw) and descriptions of their usage include both cases.
What is correct way to say? Are we ok to use mount a volume
or only create volume
?
ADDED:
I've found one "legitimate" usage of mounting a volume: in --volumes-from
flag (to create a new container that mounts that volume), but not for "good-old" --volumes
.