amazon web services - How do you share volumes between Docker containers in an Elastic Beanstalk application? -


i'm trying share data between two docker containers running in multicontainer aws ec2 instance.

normally, specify volume command flag when ran container, ie: docker run -p 80:80 -p 443:443 --link widget:widget --volumes-from widget --name nginx1 -d nginx1 share volume widget nginx1.

however, since elastic beanstalk requires specify docker configuration in dockerrun.aws.json file, , handles running docker containers internally, haven't been able figure out how share data volumes between containers.

note i'm not trying share data ec2 instance docker container -- part seems work fine; rather, share data directly 1 docker container another. know docker container volumes shared host @ "/var/lib/docker/volumes/fac362...80535" etc., since location not static don't know how reference in dockerrun.aws.json file.

has found solution or workaround?

more info on dockerrun.aws.json , config eb looking here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_v2config.html

thanks!

to accomplish want, need use volumesfrom parameter correctly. need make sure expose volume volume command container sharing internal data.

here's example dockerfile used bundle static files serving via webserver:

from tianon/true copy build/ /opt/static volume ["/opt/static"] 

now relevant parts of dockerrun.aws.json:

{     "name": "staticfiles",     "image": "mystaticcontainer",     "essential": false,     "memory": "16" }, {     "name": "webserver,     ...     "volumesfrom" : [         {             "sourcecontainer": "staticfiles"         }     ] } 

note don't need volumes entry in root of dockerrun.aws.json file, since volume shared between 2 containers, , not persisted on host. don't need specific mountpoints key in container definition holding volume shared, container volumesfrom automatically picks volumes referred container. in example, files in /opt/static in staticfiles container available webserver container @ same location.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -