![](/img/trans.png)
[英]AWS Elastic Beanstalk [error] 2540#0: *1 connect() failed (111: Connection refused) while connecting to upstream
[英]Docker on Elastic Beanstalk - connect() failed (111: Connection refused) while connecting to upstream
我正在嘗試在連接到AWS RDS上托管的外部MySQL數據庫的AWS Elastic Beanstalk(此應用程序: https : //github.com/jay3dec/PythonFlaskMySQLApp---Part-1 )上運行一個簡單的Sign Flask應用程序。
該應用程序可在本地完美運行(即使我從本地應用程序連接到AWS RDS時也是如此)。
但是,當我在命令行中打開eb時,我得到:
502 Bad Gateway
nginx/1.8.1
當我執行eb create時,收到警告:
WARN Only one EXPOSE directive is allowed, using the first one: 3306
因為在我的Dockerfile中,我有:
EXPOSE 3306
EXPOSE 5000
對於eb日志,我有:
/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添加到存儲庫中,我可以對其進行檢查
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.