DEV Community

loading...
Cover image for Unresolved domain names while docker build

Unresolved domain names while docker build

antoinega profile image Antoine ・1 min read

Photo by Kyle Glenn on Unsplash

What to do when you have github.com or chocolatey.org cannot be resolved when you try to do docker build.

Multiple possible course of action:

  • use --add-host argument in the build to give resolution

  • use --network "Default Switch" argument, to specify to RUN commands which network to use

  • add in dockerfile, for example:

RUN echo 104.20.73.28 chocolatey.org >> "C:\Windows\System32\drivers\etc\hosts"
Enter fullscreen mode Exit fullscreen mode

Hope this helps !

Discussion

pic
Editor guide