Elastic Beanstalk上的Docker连接到上游时connect()失败(111:连接被拒绝)
我试图在AWS Elastic Beanstalk上运行一个简单的Sign Up Flask应用程序(这个应用程序: https : //github.com/jay3dec/PythonFlaskMySQLApp— Part1 ),连接到AWS RDS上托pipe的外部MySQL数据库。
该应用程序在本地完美运行(即使从本地应用程序连接到AWS RDS)。
但是当我在命令行打开eb时,我得到:
502 Bad Gateway nginx/1.8.1
当我创buildeb时,我收到警告:
WARN Only one EXPOSE directive is allowed, using the first one: 3306
因为在我的Dockerfile中,我有:
EXPOSE 3306 EXPOSE 5000
对于日志logging,我有:
/var/log/nginx/error.log ------------------------------------- 2016/07/17 15:18:06 [warn] 8928#0: duplicate MIME type "text/html" in /etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker-proxy.conf:11 2016/07/17 15:18:06 [warn] 8934#0: duplicate MIME type "text/html" in /etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker-proxy.conf:11 2016/07/17 15:20:54 [error] 8937#0: *33 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.6.93, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://172.17.0.2:3306/favicon.ico", host: "flasksecgroup-dev.us-east-1.elasticbeanstalk.com", referrer: "http://flasksecgroup-dev.us-east-1.elasticbeanstalk.com/"
我的Dockerfile是:
FROM ubuntu:latest RUN apt-get update -y RUN apt-get install -y python-pip libmysqlclient-dev python-dev build- essential COPY . /app WORKDIR /app RUN pip install -r requirements.txt # Expose EXPOSE 3306 EXPOSE 5000 ENTRYPOINT ["python"] CMD ["app.py"]
这是一个端口和安全防火墙问题。 在安全组中打开3306和5000端口。 它将工作没有任何错误。
如果您可以将您的Dockerfile添加到存储库,我可以检查它
- Docker通过Ansible拉长意外时间
- 如何从亚马逊的正在运行的容器中创build一个新的Docker镜像?
- Docker容器不能在主机上写入
- 错误:在Dockerfile中找不到EXPOSE指令,中止部署+ AWS + RAILS + DOCKER
- 在CircleCI中使用ECS存储库图像作为构build图像
- 如何从Cloud Formation获得Elastic Container Repository URI?
- 为什么我的gunicorn Python / Flask工人退出信号术语?
- 无法通过S3向Elastic Beanstalk中的Docker进行身份validation
- 从ECS内部运行的Docker容器上传到s3不起作用