11---
22title : Hosting ASP.NET Core Images with Docker over HTTPS
3+ ai-usage : ai-assisted
34author : wadepickett
45description : Learn how to host ASP.NET Core Images with Docker over HTTPS
56ms.author : wpickett
67ms.custom : mvc, sfi-ropc-nochange
7- ms.date : 09/07/2024
8+ ms.date : 03/03/2026
89uid : security/docker-https
910---
1011# Hosting ASP.NET Core images with Docker over HTTPS
@@ -61,7 +62,7 @@ Run the container image with ASP.NET Core configured for HTTPS in a command shel
6162
6263``` console
6364docker pull mcr.microsoft.com/dotnet/samples:aspnetapp
64- docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="<CREDENTIAL_PLACEHOLDER>" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp
65+ docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=443 -e ASPNETCORE_Kestrel__Certificates__Default__Password="<CREDENTIAL_PLACEHOLDER>" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp
6566```
6667
6768In the preceding code, replace ` <CREDENTIAL_PLACEHOLDER> ` with the password. The password must match the password used for the certificate.
@@ -87,7 +88,7 @@ Run the container image with ASP.NET Core configured for HTTPS:
8788
8889``` console
8990docker pull mcr.microsoft.com/dotnet/samples:aspnetapp
90- docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="<CREDENTIAL_PLACEHOLDER>" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp
91+ docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=443 -e ASPNETCORE_Kestrel__Certificates__Default__Password="<CREDENTIAL_PLACEHOLDER>" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ mcr.microsoft.com/dotnet/samples:aspnetapp
9192```
9293
9394In the preceding code, replace ` <CREDENTIAL_PLACEHOLDER> ` with the password. The password must match the password used for the certificate.
@@ -107,7 +108,7 @@ Run the container image with ASP.NET Core configured for HTTPS:
107108
108109``` console
109110docker pull mcr.microsoft.com/dotnet/samples:aspnetapp
110- docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="<CREDENTIAL_PLACEHOLDER>" -e ASPNETCORE_Kestrel__Certificates__Default__Path=c:\https\aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:C:\https\ --user ContainerAdministrator mcr.microsoft.com/dotnet/samples:aspnetapp
111+ docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORTS=443 -e ASPNETCORE_Kestrel__Certificates__Default__Password="<CREDENTIAL_PLACEHOLDER>" -e ASPNETCORE_Kestrel__Certificates__Default__Path=c:\https\aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:C:\https\ --user ContainerAdministrator mcr.microsoft.com/dotnet/samples:aspnetapp
111112```
112113
113114*** NOTE:*** ` <CREDENTIAL_PLACEHOLDER> ` is a placeholder for the Kestrel certificates default password.
0 commit comments