I am trying to use curl to download releases from github and it cannot seem to resolve the domain.
I get the error curl: (6) Could not resolve host: objects.githubusercontent.com
I am running Docker on WSL 2. Part of my Dockerfile is below and it doesn’t get past the curl
command
FROM alpine:latest
WORKDIR /app
RUN apk update && apk add curl unzip
RUN curl -LO https://github.com/oven-sh/bun/releases/download/bun-v0.1.3/bun-linux-x64.zip && unzip bun-linux-x64.zip
COPY ["package.json", "bun.lockb", "./"]
RUN echo ls
RUN /usr/local/bin/bun-linux-x64/bun install
Any help is appreciated
3
Answers
Try configuring the docker daemon to use a default dns server by configuring
daemon.json
.If using Docker Desktop, you should NOT edit the file directly. It can be edited from within Docker Desktop, under
Preferences / Daemon / Advanced
.Else the file can be found (or created) at
C:ProgramDataDockerconfigdaemon.json
.Configuring the Google dns server
8.8.8.8
in an empty file would look something like this:More information about
daemon.json
can be found here.In case you don’t use the Docker Desktop app and have installed Docker in the WSL2 Ubuntu instance, edit/create a config file:
/etc/docker/daemon.json
and set default DNS:
Restart the Docker service:
It’s a silly thing to do, but check that you’re not connected to a VPN or that it’s not your internet service.