I'm trying to start an asp.net core app using docker, and I wanted to set https support.
This is my compose.yaml:
services:
web:
build:
context: .
target: final
ports:
- 8080:8080
- 443:443
volumes:
- ./webroot:/app/wwwroot/.well-known:ro
- ./https/:/app/https/:rw
environment:
ASPNETCORE_Kestrel__Certificates__Default__Path: /app/https
When the container starts I get this error:
System.UnauthorizedAccessException: Access to the path '/app/https' is denied. System.IO.IOException: Permission denied
The error is shown in the container logs in docker-desktop, Windows.
The error is initiated when calling app.Run() in Program.cs, and it started after I've added ASPNETCORE_Kestrel__Certificates__Default__Path: /app/https in my compose.yaml.
My goal was not to make https mandatory using this code, but to configure the asp.net core app to use the certificates from the https folder if they are there (after letsencrypt created them)