In this post, I’ll show you a quick fix for the error generated during the Docker image build for Sitecore.
The error you get:
Invoke-WebRequest: The request was aborted: Could not create SSL/TLS secure channel
How to fix:
This is generally the error due to the failed verification of SSL/TLS for the nuget.org feed SSL certificate. By default, the system can still use the old TLS version and hence it throws such errors. If we direct the PS to use the TLS 1.2 or higher we should fix this easily.
To fix this, you need to make a small change in the Dockerfile for the dotnetsdk.
First, find the following command in the Dockerfile.
RUN Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v$env:NUGET_VERSION/nuget.exe" -UseBasicParsing -OutFile "$env:ProgramFiles\NuGet\nuget.exe"
Replace the above command with the following one.
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v$env:NUGET_VERSION/nuget.exe" -UseBasicParsing -OutFile "$env:ProgramFiles\NuGet\nuget.exe"
Happy Sitecore on Docker!!!!