I’m running a Docker container like this:
When I call this endpoint on Postman, I get this error:
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
It doesn’t look like you’re installing a (self-signed) cert anywhere as part of your setup. I suspect changing
https
tohttp
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
If you are trying to use https connection in your local machine you need a self signed certificate.
Else try using a
http://
instead ofhttps://
.