I have successfully been able to share folders between a docker container with volumes using
docker run -v /host/path:/container/path ...
B
VOLUME is used in Dockerfile to expose the volume to be used by other containers. Example, create Dockerfile as:
FROM ubuntu:14.04
RUN mkdir /myvol
RUN echo "hello world" > /myvol/greeting
VOLUME /myvol
build the image:
$ docker build -t testing_volume .
Run the container, say container1:
$ docker run -it
Now run another container with volumes-from option as (say-container2)
$ docker run -it --volumes-from
You will get all data from container1 /myvol directory into container2 at same location.
-v option is given at run time of container which is used to mount container's directory on host. It is simple to use, just provide -v option with argument as . The whole command may be as $ docker run -v