'Docker Access to the path '/https/aspnet.pfx' is denied

I opened this topic because I couldn't find the right answer despite all my searches.

Linux container running on my local windows computer, It could not stand up as a linux container in a linux server

When I follow the logs on the portainer, it gives an error as follows: Dockerfile

enter image description here

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim as build
USER root
RUN dotnet dev-certs https
WORKDIR /app
EXPOSE 80
EXPOSE 443
COPY Shared/Portfolio.Shared/*.csproj Shared/Portfolio.Shared/
COPY Services/Setting/Porfolio.Services.Setting.API/*.csproj Services/Setting/Porfolio.Services.Setting.API/ 
RUN dotnet restore  Services/Setting/Porfolio.Services.Setting.API/*.csproj
COPY . .
RUN dotnet publish Services/Setting/Porfolio.Services.Setting.API/*.csproj -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim as runtime
WORKDIR /app
COPY --from=build /app/out .
ENTRYPOINT [ "dotnet","Porfolio.Services.Setting.API.dll" ]

this is how my docker image is configured

docker-compose.override.yml

  setting.api:
    container_name: setting.api
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - IdentityServerURL=http://identityserver.api
      - DatabaseSettings:ConnectionString=mongodb://settingdb
      - ASPNETCORE_URLS=https://+:443;http://+:80
      - ASPNETCORE_HTTPS_PORT=19052
      - ASPNETCORE_Kestrel__Certificates__Default__Password=zk147olu
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/dev_cert.pfx
    restart: on-failure
    ports:
      - "5105:80"
      - "19052:443"
    volumes:
      - ${HOME}/.aspnet/https:/https/dev_cert.pfx:ro
    depends_on:
      - settingdb

what is my problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source