docker-https
设置ssl证书
docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="crypticpassword" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/DockerDemo.pfx -v /mnt/c/Users/JinXi/AppData/Roaming/ASP.NET/Https:/https/ dockerdemo:new
%APPDATA%\ASP.NET\Https
默认证书位置
DockerDemo
项目名称,必须要证书名称一致
crypticpassword
SSL证书密码
DockerDemo\DockerDemo.csproj
项目相对路径C:\Users\JinXi\AppData\Roaming\ASP.NET\Https
可以使用相对路径user-secrets
dotnet user-secrets remove "Kestrel:Certificates:Development:Password" -p DockerDemo\DockerDemo.csproj
dotnet dev-certs https --clean
dotnet dev-certs https -ep C:\Users\JinXi\AppData\Roaming\ASP.NET\Https\DockerDemo.pfx -p crypticpassword
dotnet dev-certs https --trust
dotnet user-secrets -p DockerDemo\DockerDemo.csproj set "Kestrel:Certificates:Development:Password" "crypticpassword"
/mnt/c/Users/JinXi/AppData/Roaming/ASP.NET/Https
为wsl下的绝对路径docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="crypticpassword" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/DockerDemo.pfx -v /mnt/c/Users/JinXi/AppData/Roaming/ASP.NET/Https:/https/ dockerdemo:new