连接docker localhost 5000时获取空白页

时间:2019-12-07 04:05:33

标签: docker asp.net-core

当我在Docker中运行.net核心应用程序时出现以下错误 无法连接到本地主机端口5000:与Docker的连接被拒绝

搜索解决方案并尝试了此方法

  

docker服务创建--name注册表--publish Published = 5000,target = 5000,mode = host注册表:2

我也在docker中暴露了端口5000 现在我得到一个空白页。感谢任何帮助。

docker文件-

FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 5000

FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /src
COPY ["MyApi.csproj", ""]
RUN dotnet restore "/MyApi.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "MyApi.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "MyApi.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MyApi.dll"]

0 个答案:

没有答案