Unable to build an image used with docker-101 tutorial

I’m trying to walk thru Docker 101 Tutorial | Docker locally using my laptop, instead of the Play with Docker option. When I ran docker build -t docker-101 ., I got the following error:

#8 5.752 info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".                                                                             
#8 5.752 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
#8 5.752 error An unexpected error occurred: "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz: getaddrinfo EAI_AGAIN registry.yarnpkg.com registry.yarnpkg.com:443"

Below is the Dockerfile

FROM node:10-alpine
COPY . .
RUN yarn install --production
CMD ["node", "/app/src/index.js"]

I was able to run yarn install --production from my WSL ubuntu terminal.

I moved the topic from the community category which is for asking about events and the community not for issues, but I moved it too quickly since I guess you ae using Docker Desktop on Windows (which could be an other category). Am I right?

It looks like you have a network issue with Docker Desktop.

I’m not using Docker Desktop. The issue seems to be network-related. How do I verify that? How do I get more diagnostic info?

I thought you were when you mentioned that the command worked from WSL. So you mean you installed Docker CE inside the WSL distribution and yarn install works from WSL, but not in container running in the WSL distribution?

you could try to use curl or wget in the container or anything that you can use with an IP address to see if the issue is DNS or other network problem.

You also need to be careful in WSL, because it gets new IP range after every reboot and sometimes it can result an IP range conflict with one of the Docker networks. It it is the case you can change the default-address-pool

How did you install Docker in WSL?

I used a provided wrapper/bootstrapper that installs WSL and docker engine. Is there a way to display the method by which Docker was installed?

Yes, yarn install works from WSL’s ubuntu terminal/cmdline, but it failed inside Dockerfile.

Do you have a link to that wrapper?

It’s an internal link and thus won’t be sharable.

Then I have to quote myself

Or you can to create a new WSL distribution installed from the Store and install Docker inside WSL following the official documentation and see if you still have the issue. https://docs.docker.com/engine/install/#server