簡體   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