4

I have a docker file to install sql server on windows server core. the below command fails with error

Docker Command

RUN Invoke-WebRequest -Uri $env:box -OutFile SQL.box ;      Invoke-WebRequest -Uri $env:exe -OutFile SQL.exe ;         Start-Process -Wait -FilePath .\SQL.exe -ArgumentList /qs, /x:setup ;         .\setup\setup.exe /q /ACTION=Install /INSTANCENAME=MSSQLSERVER /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT='NT AUTHORITY\System' /SQLSYSADMINACCOUNTS='BUILTIN\ADMINISTRATORS' /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS ;         Remove-Item -Recurse -Force SQL.exe, SQL.box, setup

Error Message

Invoke-WebRequest : The remote name could not be resolved: 'go.microsoft.com' At line:1 char:76 + ... lyContinue'; Invoke-WebRequest -Uri $env:box -OutFile SQL.box ; Invok ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt pWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeWebRequestCommand

The same docker file worked yesterday, but today it is failing continuously. Anyone has faced similar issue?

Mathiyazhagan
  • 1,389
  • 3
  • 13
  • 37
  • Something is broken with DNS. Try to build on different machine. Usually it's environmental issue which has nothing to do with Invoke-WebRequest. Disable firewall/AV etc – Gregory Suvalian Jul 17 '19 at 11:32

2 Answers2

3

Configure the Docker daemon by typing a json Docker daemon configuration file. { .... "dns": ["1.1.1.1","8.8.8.8", "8.8.4.4"], ... }

Max Manets
  • 31
  • 2
0

I'm not sure what the problem is exactly but this worked for me:

Check out this script: https://github.com/MicrosoftDocs/Virtualization-Documentation/tree/master/windows-server-container-tools/CleanupContainerHostNetworking

Save it somewhere (or clone the whole repo). Run the cleanup command that suits your needs and restart your machine.