【发布时间】:2019-11-25 03:02:42
【问题描述】:
我在 docker 中运行 .net 核心应用程序,当我将映像部署到亚马逊 Elastic Beanstalk 时,状态正常,但是当我尝试访问该页面时,我得到“502 Bad Gateway nginx/1.14.1”
Docker 文件:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["MyApp.csproj", "."]
RUN dotnet restore "MyApp.csproj"
COPY . .
RUN dotnet build "MyApp.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "MyApp.csproj" -c Release -o /app
FROM base AS final
WORKDIR . /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MyApp.dll"]
Dockerrun.aws.json
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "xxxx/myapp",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "80"
}
]
}
日志:
2019/07/16 10:55:34 [error] 13553#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 185.32.153.2, server: , request: "GET / HTTP/1.1", upstream: "http://172.17.0.3:80/", host: "myapp-env11.us-east-1.elasticbeanstalk.com"
我应该打开哪个端口才能运行它?
【问题讨论】:
-
在同样的事情上挣扎。有没有想过这个?
-
所以没有人想到这一点? @kaszanka 你是怎么解决这个问题的?
标签: c# docker amazon-ec2 .net-core amazon-elastic-beanstalk