Elastic Beanstalk和Docker启动错误

我目前有一个很好的私人托pipe的docker形象。 在容器内运行一个ASP.NET Web API核心应用程序。

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 . 

upstream是在http块级应用程序,包括你的创build是在服务器级。 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