繁体   English   中英

Docker 在 Postman 中找不到响应

[英]Docker Can't Find Response in Postman

我正在使用 Docker Compose 文件运行两个 Docker 容器,一个是我已经发布的映像,另一个是构建。 当我转到配置的位置时看不到图像。

Docker 撰写

version: '3.4'

services:
  twslogging:
    image: ${DOCKER_REGISTRY-}twslogging
    build:
      context: .
      dockerfile: twsLogging\Dockerfile
    ports:
      - '8000:8000'
  twsUsers:
    image: tbennet/twsusers
    ports:
      - '7000:7000'

DockerFile Loggin(一个内置的Docker compose Up)

#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/core/aspnet:3.0-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 8000

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-nanoserver-1803 AS build
WORKDIR /src
COPY ["twsLogging/twsLogging.csproj", "twsLogging/"]
RUN dotnet restore "twsLogging/twsLogging.csproj"
COPY . .
WORKDIR "/src/twsLogging"
RUN dotnet build "twsLogging.csproj" -c Release -o /app/build

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

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

DockerFile(发布的用户 Docker 文件)

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
EXPOSE 7000

FROM mcr.microsoft.com/dotnet/core/sdk:3.0-nanoserver-1803 AS build
WORKDIR /src
COPY twsUsers/nuget.config ./
COPY ["twsUsers/twsUsers.csproj", "twsUsers/"]
COPY ["twsDatabase/twsDatabase.csproj", "twsDatabase/"]
COPY . .
RUN dotnet restore "twsUsers/twsUsers.csproj" --configfile ./nuget.config
WORKDIR "/src/twsUsers"
RUN dotnet build "twsUsers.csproj" -c Release -o /app/build

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

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

邮递员在此输入图片说明

好的,我找到了答案,感谢他们帮助我找到正确位置的评论。 所以对于 .net Core,这就是你要做的。 在您的端口上,端口 localhost 号然后是 80,所以我将端口更改为 7000:80 并运行 compose 并且它出现了。 我在这里找到了答案https://github.com/dotnet/dotnet-docker/blob/master/samples/run-aspnetcore-https-development.md

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM