-
将自签名证书从此脚本添加到映像:
import-module webadministration
cd cert:
$cert = New-SelfSignedCertificate -DnsName myweb -Friendlyname MyCert -CertStoreLocation Cert:\LocalMachine\My
$rootStore = New-Object System.Security.Cryptography.X509Certificates.X509Store -ArgumentList Root, LocalMachine
$rootStore.Open("MaxAllowed")
$rootStore.Add($cert)
$rootStore.Close()
cd iis:
new-item -path IIS:\SslBindings\0.0.0.0!443 -value $cert
New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https
iisreset
-
文件:添加端口443。
version: '3.4'
services:
testapp.svc:
ports:
- "9091:80"
- "9092:443"
-
FROM microsoft/aspnet:4.7.1
WORKDIR /inetpub/wwwroot
EXPOSE 80
EXPOSE 443
COPY index.html .
COPY certificate.ps1 .
RUN powershell.exe ./certificate.ps1