skip to Main Content

I’m running a Docker container like this:

enter image description here

When I call this endpoint on Postman, I get this error:

enter image description here

My Dockerfile.yml is like this:

    FROM mcr.microsoft.com/dotnet/sdk:7.0 AS base
    WORKDIR /app

    FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
    WORKDIR /src
    COPY . .

    RUN dotnet restore "CentralAPI/CentralServiceAPI.csproj"
    WORKDIR "/src/."
    COPY . .
    RUN dotnet build "CentralAPI/CentralServiceAPI.csproj" -c Release -o /app/build

    FROM build as publish
    RUN dotnet publish "CentralAPI/CentralServiceAPI.csproj" -c Release -o /app/publish

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

I’m new to Docker. I tried disabling proxy in Postman settings and on Internet Options.
I also tried to ping the connection like this, the results:

# curl https://localhost:8080
curl: (7) Failed to connect to localhost port 8080: Connection refused

I’m using VS Code and I’m on Windows.
My API is running on port https://localhost:7102/ if launched with IIS.

2

Answers


  1. It doesn’t look like you’re installing a (self-signed) cert anywhere as part of your setup. I suspect changing https to http will solve the immediate connectivity issue.

    However, if you do want to use a TLS cert locally, you’ll need to do some additional work. Something like this: https://www.labkey.org/Documentation/wiki-page.view?name=dockerTLS

    Login or Signup to reply.
  2. If you are trying to use https connection in your local machine you need a self signed certificate.

    Else try using a http:// instead of https://.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search