There is another feature of Docker volumes that allows you to share the volume(s) mounted in one Docker container with other containers. It is called data volume containers. Using data volume containers is basically a two-step process. In the first step, you run a container that either creates or mounts Docker volumes (or both), and in the second step, you use the special volume parameter, --volumes-from, when running other containers to configure them to mount all of the volumes mounted in the first container. Here is an example:
# Step 1
docker container run \
--rm -d \
-v data-vol-01:/data/vol1 -v data-vol-02:/data/vol2 \
--name data-container \
vol-demo2:1.0 tail -f /dev/null
# Step 2
docker container run \
--rm -d \
--volumes-from data-container \
--name app-container \
vol-demo2:1.0 tail -f /dev/null...