I have a windows container where I am installing a product to dockerfy the install.
The base image is Microsoft Artifact Registry
I have enabled TLS on the image and generated a certificate to use, currently this is self signed but I have tested with signed, the certificate is generated for “localhost” which has stopped all SSL errors for the workflow I need and is perfect for what I currently require.
however when I use PowerShell in the container and make a invoke-webrequest to ht t p s:/ /localhost or htt ps : / /127.0.0.1 I get this:
Invoke-WebRequest htt p s /localhost
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
- Invoke-WebRequest ht tps /localhost
-
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
searching this error I am told to check TLS settings on the machine using this command, however they are already set as exspected:
SystemDefault
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12
PS C:\temp> System.Net.ServicePointManager::SecurityProtocol
Tls, Tls11, Tls12
Invoke-WebRequest ht ps:/ /loca lhost
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
- Invoke-WebRequest ht t ps: / /localhost
-
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
This said, I can access the container over tls from the host machine using the mapped localhost:8003 port.
Can any help me get invoke-webrequest working to localhost? This is a requirement of the application I am testing for.
Thankyou
Please excuse the extra spaces in my ht t p: etc, I am forced to do this to let me post the correct error messages