Elastic Beanstalk 和 Docker 启动错误
Posted
技术标签:
【中文标题】Elastic Beanstalk 和 Docker 启动错误【英文标题】:Elastic Beanstalk and Docker launch error 【发布时间】:2018-03-09 14:53:45 【问题描述】:我目前有一个私人托管的 docker 镜像,可以正常工作。 在容器中,我运行一个 ASP.NET Web API Core 应用程序。
AWS 有 nginx,当 Elastic Beanstalk 启动时,有时当我上传应用程序的新版本时,它会返回此错误。谁能指出我做错了什么?
-------------------------------------
/var/log/nginx/error.log
-------------------------------------
2017/09/27 12:02:53 [emerg] 3161#0: no host in upstream "docker" in /etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf:21
这是我的 Dockerrun.aws.json
"AWSEBDockerrunVersion": "1"
.ebextensions/00_nginx.config 文件
files:
"/etc/nginx/sites-available/elasticbeanstalk-nginx-docker-proxy-timeout.conf" :
mode: "000755"
owner: root
group: root
content: |
upstream docker
server 127.0.0.1:52940;
keepalive 360;
client_max_body_size 100G;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
proxy_read_timeout 3600;
client_body_timeout 3600;
client_header_timeout 360;
send_timeout 3600;
keepalive_timeout 360;
container_commands:
01-restart-nginx:
command: /sbin/service nginx restart
还有我的 Dockerfile
FROM microsoft/aspnetcore:1.1
LABEL name "<my_application>"
WORKDIR /app
ENV ASPNETCORE_URLS http://*:52940
EXPOSE 52940
ENTRYPOINT ["dotnet", "<my_application>.dll"]
COPY out .
【问题讨论】:
【参考方案1】:upstream
是http
块级别的应用程序,您创建的包含在服务器级别进行。 http
级别包括进入conf.d
目录和server
级别包括进入sites-available
files:
"/etc/nginx/conf.d/elasticbeanstalk-nginx-docker-upstream.conf" :
mode: "000755"
owner: root
group: root
content: |
upstream docker
server 127.0.0.1:52940;
keepalive 360;
"/etc/nginx/sites-available/elasticbeanstalk-nginx-docker-proxy-timeout.conf" :
mode: "000755"
owner: root
group: root
content: |
client_max_body_size 100G;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
proxy_read_timeout 3600;
client_body_timeout 3600;
client_header_timeout 360;
send_timeout 3600;
keepalive_timeout 360;
container_commands:
01-restart-nginx:
command: /sbin/service nginx restart
【讨论】:
以上是关于Elastic Beanstalk 和 Docker 启动错误的主要内容,如果未能解决你的问题,请参考以下文章
Elastic Beanstalk、Docker 和持续集成
Amazon Elastic BeanStalk 错误:无法创建 AWS Elastic Beanstalk 应用程序版本
Cloudformation 协助 Elastic Beanstalk 和 Application Load Balancer