以前我们的应用程序在.net框架上运行,我们使用powershell通过运行以下命令将我们的证书安装到证书存储中:
RUN powershell -NoProfile -Command \
$Secure_String_Pwd = ConvertTo-SecureString "ourverysecretpassword" -AsPlainText -Force ; \
Import-PfxCertificate -FilePath /cert.pfx -CertStoreLocation Cert:\LocalMachine\Root -Exportable -Password $Secure_String_Pwd
但现在我们已将代码转移到.netcore,上面的命令不再适用于dockerfile.
有关如何通过dockerfile将现有.pfx证书安装到docker容器中的任何想法?
[编辑]我试图在Windows上运行我的容器,这里是完整的dockerfile,也许只是我使用了错误的图像:
这是整个docker文件:
FROM microsoft/dotnet
COPY ./Web /app/
COPY cert.pfx /cert.pfx
RUN powershell -NoProfile -Command \
$Secure_String_Pwd = ConvertTo-SecureString "againourverysecretpassword" -
AsPlainText -Force ; \
Import-PfxCertificate -FilePath /cert.pfx -CertStoreLocation
Cert:\LocalMachine\Root -Exportable -Password $Secure_String_Pwd
WORKDIR /app
EXPOSE 5000
ENTRYPOINT ["dotnet", "myhost.dll"]
Run Code Online (Sandbox Code Playgroud)
无论如何它在运行powershell命令时失败,说:'powershell'不被识别为内部或外部命令,可操作程序或批处理文件.