2

I"m following the guide on this page below. But I keep getting error below. I'm using Win 10 Enterprise 1809

"Invoke-WebRequest : The remote name could not be resolved: 'dist.nuget.org'"

https://doc.sitecore.com/developers/100/developer-tools/en/walkthrough--using-the-getting-started-template.html

enter image description here

I tried the solution on this page below but didn't work:

https://containers.doc.sitecore.com/docs/troubleshooting#windows-containers-cant-access-the-internet

3
  • Looks like your corp firewall blocking .exe , first check if the URL is opening in browser
    – Abhay Dhar
    Commented Aug 14, 2020 at 6:26
  • It does and can also yun same request with no issue on host machine
    – Nil Pun
    Commented Aug 14, 2020 at 8:45
  • I was having same issue also. It seems like there are many different reasons for this see github.com/docker/for-win/issues/2760 In my case is was fixed by github.com/docker/for-win/issues/2760#issuecomment-557654976 but you might have different issue. I would go through entire thread and see if something fixes it.
    – Jeroen
    Commented Aug 18, 2020 at 14:28

6 Answers 6

7

That might be related to your firewall settings.

One of the things you can try is to add custom DNS to Docker engine config file. You can use the Google one - 8.8.8.8

The format is as following:

"dns":["8.8.8.8"]

It should look like this: enter image description here

5

I had this similar error and none of the above solutions worked.

As a workaround, I tried the below steps:

  1. Downloaded nuget.exe, manually using this https://dist.nuget.org/win-x86-commandline/v5.6.0/nuget.exe
  2. Create an empty folder as "Nuget" under "C:\Program Files". -- C:\Program Files\Nuget
  3. Copy the nuget.exe to C:\Program Files\Nuget\
  4. Comment this line in Dockerfile, available in ROOT_PROJECT\docker\build\dotnetsdk\Dockerfile
  5. ## RUN Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/v5.6.0/nuget.exe" -UseBasicParsing -OutFile "$env:ProgramFiles\NuGet\nuget.exe"
  6. Afterwards run .\up.ps1 again

Hope this could help you.

4

I had the same error.

You can list enabled security protocols with the following command:

RUN [Net.ServicePointManager]::SecurityProtocol

If you don't see Tls 1.2 (at the moment this is the lowest version nuget allows), you need to enabled it.

You need to enable the security protocol in the same RUN command, since it is not persisted.

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"
4

As it turns out, Docker for Windows uses the network adapter with the lowest Id

To Check:

Get-NetIPInterface -AddressFamily IPv4 | Sort-Object -Property InterfaceMetric -Descending

enter image description here

Next, set the Interface Metric to 1 for Wi-Fi

Set-NetIPInterface -InterfaceAlias 'Wi-Fi' -InterfaceMetric 1

enter image description here

Note:

If your host's primary network adapter is bridged because you have an External virtual switch setup in Hyper-V, then you will set the external virtual switch to have the lowest InterfaceMetric value.

1

It seems that request is blocked by network policies/firewall/proxy.

You can run docker image with powershell ping command to check if dist.nuget.org is accessible in docker scope:

docker run --rm mcr.microsoft.com/windows/servercore:1903 powershell ping dist.nuget.org

Pinging cs2.wpc.gammacdn.net [152.199.23.209] with 32 bytes of data:
Reply from 152.199.23.209: bytes=32 time=16ms TTL=55
Reply from 152.199.23.209: bytes=32 time=10ms TTL=55
Reply from 152.199.23.209: bytes=32 time=9ms TTL=55
Reply from 152.199.23.209: bytes=32 time=9ms TTL=55

Ping statistics for 152.199.23.209:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 9ms, Maximum = 16ms, Average = 11ms

If ping failed - check your network policies/firewall/proxy.

If ping is succesfull - it can be old TLS version enabled as a default (by default PowerShell will use TLS 1.0 when using Invoke-WebRequest).

Try to add:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

in the beginning of the up.ps1.

2
  • I tried above command it doesn't work and also tried adding TLS fix. Still doesn't work. I can run the same web invoke command on PS with no issue. Is the script trying to get nuget.exe from within container?
    – Nil Pun
    Commented Aug 15, 2020 at 5:48
  • Adding SecurityProtocolType with TLS12 and TLS11 and then running the Invoke-WebRequest were successful. Commented Sep 10, 2021 at 19:01
0

For me the solution provided by above to set the Wifi Interface Metric to 1.

It is perfectly working for me.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jul 9, 2022 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.