Reputation: 397
Sorry I'm not sure of the correct terminology ( So I'll try to get my point across by using it all). Sorry still new to docker.
I need a way to [link/mount volume/volume_from] storage between containers - but cant seem to figure it out. I don't want to use the host machine as I'm trying to share access to a large s3 bucket - i.e. host machine physically can't store a copy of it all.
web:
hostname: web
image: mprasil/webdav
ports:
- "80:80"
links:
- s3
volumes:
- /local/dir/:/site/input/
s3:
image: xueshanf/s3fs
Upvotes: 1
Views: 2184
Reputation: 45323
There is an option --volumes-from
you can use.
$ docker create -v /dbdata --name dbdata training/postgres /bin/true
You can then use the --volumes-from flag to mount the /dbdata volume in another container.
$ docker run -d --volumes-from dbdata --name db1 training/postgres
And another:
$ docker run -d --volumes-from dbdata --name db2 training/postgres
In this case, if the postgres image contained a directory called /dbdata then mounting the volumes from the dbdata container hides the /dbdata files from the postgres image. The result is only the files from the dbdata container are visible.
You can use multiple --volumes-from parameters to bring together multiple data volumes from multiple containers.
So in your case, you can update docker-compose.yaml
in container web
:
volumes_from:
- s3
refer: Managing data in containers: Creating and mounting a data volume container
docker-compose.yml reference: volumes_from
Upvotes: 1