Common Issues encountered while hosting your web app / website within a Container ( versus hosting it on the host server )
Issue 1 – Domain Joining Issue for Containers: A server can be domain joined. A container cannot.
Solution to Issue 1 – Use an Active Directory gMSA. Create a gMSA in AD – and run the container as an authorized service under this gMSA (like a service account). This essentially ‘joins’ the container to the Domain.
Issue 2 – Installing certificates for your website / webapp inside a container
Solution to Issue 2 – You need powershell on windows or bash on linux. For Windows, add the following to your DOCKERFILE
RUN mkdir C:\cert #cert folder contains the certificates MyCertificate.cer & myprivatekey.pfx. Add these to the docker folder /cert ADD cert/ /cert RUN powershell -NoProfile -Command \ certutil -addstore "Root" "C:/cert/MyCertificate.cer" RUN powershell -NoProfile -Command \ certutil -importpfx -p "password" "C:/cert/myprivatekey.pfx" RUN powershell -NoProfile -Command \ New-WebBinding -Name "YourWebsite" -IP "*" -Port 1234 -Protocol https RUN powershell -NoProfile -Command \ get-item cert:\LocalMachine\MY\thumbprint-of-your-cert | New-Item 0.0.0.0!1234
Leave a Reply