简体   繁体   中英

Docker Can't Find Response in Postman

I'm using a Docker Compose file to run two Docker Containers One an Image I already published and one a build. I can not see the image when I go to the configured location.

Docker Compose

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 (One Built-in 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 (Users Docker file that is published)

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"]

PostMan enter image description here

Ok, I found the answer thanks for the comments they helped me look in the right spot. So For .net Core, this is what you do. on your port the port localhost number then 80 so I changed my port to 7000:80 and ran the compose and it came up. I found the answer looking here https://github.com/dotnet/dotnet-docker/blob/master/samples/run-aspnetcore-https-development.md

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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