我在docker中运行了.net核心应用程序,当我将映像部署到Amazon Elastic Beanstalk时,状态还可以,但是当我尝试访问该页面时,我会收到“ 502 Bad Gateway nginx / 1.14.1”
DockerFile:
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"
我应该打开哪个端口才能运行它?