【问题标题】:Elastic Beanstalk and Docker launch errorElastic Beanstalk 和 Docker 启动错误
【发布时间】: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 .

【问题讨论】:

    标签: amazon-web-services docker nginx amazon-elastic-beanstalk


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 2019-07-07
      • 2014-11-22
      • 2014-08-07
      • 2013-08-01
      • 2013-12-22
      • 2014-07-18
      • 2018-12-05
      • 2021-07-11
      • 2015-01-26
      相关资源
      最近更新 更多