How to setup the dotnet dev-certs on Linux without affecting the repository?

  .net-core, c#, docker, linux, ssl-certificate

I’m using Pop!_OS 20.04 LTS (based on Ubuntu) and want to run a .Net Web Api in a Docker container. Unfortunately I get this exception

Unable to start Kestrel. System.InvalidOperationException: Unable to
configure HTTPS endpoint. No server certificate was specified, and the
default developer certificate could not be found or is out of date. To
generate a developer certificate run ‘dotnet dev-certs https’. To
trust the certificate (Windows and macOS only) run ‘dotnet dev-certs
https –trust’. For more information on configuring HTTPS see

when running the container with this docker-compose file

version: '3.9'
      - '443:443'
      - '80:80'
    image: api
      - ASPNETCORE_URLS=https://+:443;http://+:80

and this Dockerfile

FROM AS build

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

EXPOSE 443 80
COPY --from=build /app/out .
ENTRYPOINT [ "dotnet", "Api.dll" ]

So Windows and Mac users can solve this problem pretty easily as described here

but it seems Ubuntu users have to do it as described here

I’m not sure if I should use this solution because in step 3 I would have to modify the appsettings.json file although I think my local setup shouldn’t affect the repository at all.

Many people are maintaining the repository so all of us would have to solve it "somehow" for their OS/machine.

Is there an equivalent for the

dotnet dev-certs https --trust

command for Linux users in 2021? This little solution is way more easier to keep in the "getting started wiki" than creating a big guide on how to setup the repository when working on Linux…

Source: Docker Questions