Wednesday, October 23, 2019

Sitecore Docker Setup; "curl: (6) Could not resolve host"


Given the general Docker hype and the clear signals that as an industry containerization adoption will continue becoming more widespread, I decided to take Docker for another spin after several years ignoring it completely and begin fiddling with Sitecore Docker Images.

Sticking closely to the quick start guide on the community-driven Sitecore Docker Images repository - I ran into one snag:


curl: (6) Could not resolve host: dist.nuget.org
curl: (6) Could not resolve host: download.microsoft.com
curl: (6) Could not resolve host: aka.ms
curl: (6) Could not resolve host: www.7-zip.org

The \docker-images\windows\9.0.2\sitecore-assets\Dockerfile itself only confirmed that a simple curl command initializes the download process from several hard-coded sources:

After some Googling, I found a post - Fix Docker's networking DNS config -by @nottrobin which outlined a similar error.

The key takeaway: this happens "usually because DNS lookups are failing in Docker images".

Their recommendation is to "change the DNS settings of the Docker daemon" by adding a new configuration file to /etc/docker/daemon.json - which I couldn't find.  Given that I'm using a Windows 10 machine and @nottrobin was using Linux, my guess is that there are path differences here. 

I ended up modifying the following file:
C:\ProgramData\Docker\config\daemon.json

And adding a new "dns" parameter (pointing to Google's public 8.8.8.8 DNS)

After saving and restarting Docker, the 'Could not resolve host' error no longer killed the build process. 戊



11 comments:

  1. Replies
    1. Great Article Cloud Computing Projects

      Networking Projects

      Final Year Projects for CSE

      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. I had a similar error message when trying to attach the VS debugger to the docker image. I was connected to an unrelated vpn, and when I disconnected from the vpn and restarted the docker image, the dns worked on the docker image.

    ReplyDelete
  3. Hi, I tried changing the DNS and restarted Docker, but I still run into the same issue. Any help would be appreciated.

    ReplyDelete
  4. It's works for me!

    Funcionou aqui no Brasil =D

    ReplyDelete