如何连接AWS ElasticBeanstalk中的多个Docker容器?
我有一个Docker multicontainerconfiguration,意图在ElasticBeanstalk环境中运行。
EB环境在公共子网中的VPC中运行,具有单个负载均衡器和单个实例绑定。
它看起来像所有的容器运行良好,但他们不能相互沟通,即使我把它们定义为链接的容器。
我需要做什么才能让所有这些容器相互对话?
我的Dockerrun.aws.json看起来像这样:
"containerDefinitions": [ { "name": "proxy", "image": "nginx", "essential": true, "memory": 128, "portMappings": [ { "hostPort": 80, "containerPort": 80 } ], "links": [ "webapp" ], "mountPoints": [ { "sourceVolume": "nginx-conf", "containerPath": "/etc/nginx/conf.d", "readOnly": true }, { "sourceVolume": "awseb-logs-proxy", "containerPath": "/var/log/nginx" } ] }, { "name": "webapp", "image": "jetty", "memory": 2048, "essential": true, "portMappings": [ { "hostPort": 8080, "containerPort": 8080 } ], "links": [ "mongodb" ], "mountPoints": [ { "sourceVolume": "jetty-webapp", "containerPath": "/var/lib/jetty/webapps", "readOnly": false }, { "sourceVolume": "awseb-logs-webapp", "containerPath": "/var/log/jetty" } ] }, { "name": "mongodb", "image": "mongo", "memory": 1024, "essential": true, "portMappings": [ { "hostPort": 27017, "containerPort": 27017 } ], "mountPoints": [ { "sourceVolume": "mongodb-data", "containerPath": "/data/db", "readOnly": false } ] } ]
在我的情况下,它与安全组无关,因为我公开暴露的Nginx代理是80。
它归结为使用我的/ etc / host(webapp,mongodb)中的名称,而不是为容器创build的IP。
这修复了我从Nginx到Jetty和Jetty到MongoDB的连接。
在2017年,使用容器定义: links
与要连接的Docker容器的名称。 Docker的内置网桥将从那里build立连接。
- 失败(404错误)通过AWS EBS泊坞窗环境中的Nginx访问Amazon Linux API泊坞窗服务
- AWS Elastic Beanstalk Docker PHP应用程序
- 什么触发Elastic Beanstalk拉入更新的Docker镜像
- 如何从Elastic Beanstalk实例访问S3存储桶中的dockerconfiguration文件
- Dockerrun.aws.json文件的私人dockerhub图像
- Docker卷指向文件的弹性beanstalk
- 如何设置运行Django的AWS Elastic Beanstalk Docker平台?
- 运行多容器Docker的AWS BeanStalk环境无法启动Health:Severe
- AWS ElasticBeanstalk Multidocker未使用正确的Cmd创buildECS任务