I'm running an Asp.net core site on Docker that works normally when not using https. When using https it gives me an error.
The error is being caused by this environment variable: ASPNETCORE_URLS=https:// :443
. I've seen many solutions to similar problems and their solution was to simply remove this. Removing the https allows the server to start, but I can't connect to it from my browser. Then again, I'm still looking for a solution where https works, not just a general solution.
Here is the error: link. Correct me if I'm wrong but I don't think it's a certificate problem. I'm usually decent at interpreting errors but I can't make sense of this one for the life of me.
My dockerfile is pretty much the same as the microsoft example dockerfile except with different names and paths.
Here is my docker-compose.yml file. The same error happens even if I get rid of 443 and 80 from the env. variable.
version: "3.0"
services:
webapp:
image: webapp
stdin_open: true
tty: true
environment:
- ASPNETCORE_URLS=https:// :443;http:// :80
- ASPNETCORE_Kestrel__Certificates__Default__Password=crypticpassword
- ASPNETCORE_HTTPS_PORT=443
- ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
volumes:
- /home/user/.aspnet/https:/https/
network_mode: "host"
The same error happens when manually running using docker run
with -e
environment variables, etc.
CodePudding user response:
Credit to Hans Kilian.
Set environment variable TZ to your timezone.
- For docker run: TZ="Asia/example"
- For docker-compose: just remove the quotes