【发布时间】:2021-03-25 07:28:52
【问题描述】:
enter image description here 我的 docker compose 文件似乎运行良好,在 docker 仪表板中我看到相应的容器正在工作。
当我转到 http://localhost:6001/ 时,我看到的只是一条错误消息,内容如下:
'此页面无法正常工作。 localhost 没有发送任何数据。 ERR_EMPTY_RESPONSE'。
我不知道如何解决这个问题。我在某处看到将 localhost 替换为“0.0.0.0”,但不确定如何在这种情况下执行此操作,我觉得我已经看到它与 localhost 一起使用,所以我不确定如何处理这些信息。
我检查了其他来源,看看我做错了什么,但没有找到好的解决方案。我很想就这个问题寻求任何建议!
我的Dockerfile:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["TestDocker.csproj", "."]
RUN dotnet restore "./TestDocker.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "TestDocker.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "TestDocker.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TestDocker.dll"]
【问题讨论】:
-
您实际上是如何启动容器的?您在问题中附加了哪些图片?
-
我尝试了这两种方法 - 从 docker 桌面工具和 docker run -p 6001:8080 命令(浏览 localhost:6001 端口)以及。没有运气
标签: docker dockerfile containers