Previously our application ran on .net framework and we used powershell to install our certificate into the certificate store by running the following command:
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
but now we have transferred our code to .netcore, the above command wont work in the dockerfile anymore.
Any idea on how to install an existing .pfx certificate via the dockerfile into the docker container?
[EDIT] Im trying to run my container on windows, here is the complete dockerfile, maybe its just that i use the wrong image:
This is the entire docker file:
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"]
Anyhow it fails on the run powershell command, saying: 'powershell' is not recognized as an internal or external command, operable program or batch file.