Reputation: 821
I have a Docker container named "data-container" which has a directory named /var/data. This directory is in fact an ObjectiveFS volume which is stored in AWS S3. In addition, I have a second container named "app-container" which needs access to the /var/data directory in "data-container".
Is there a pure-Docker way of allowing "app-container" to read/write data to the directory in "data-container"? I could probably do that using NFS but I'm not sure that's the right way to go.
Upvotes: 0
Views: 102
Reputation: 2690
It's simple!
First create a data volume container
docker create -v /data --name mystore ubuntu /bin/true
Then you can bind this "/data" mount to other container over the "--volumes-from" parameter like so:
docker run -d --volumes-from mystore --name db1 postgres
You find this description here in the Docker docs:
https://docs.docker.com/engine/userguide/containers/dockervolumes/
Chapter: Creating and mounting a data volume container
Upvotes: 3