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
WORKDIR /app
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 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
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
I ran the same command today, docker build -t docker-101 ., and to my surprise, it built successfully. I am not aware of any intentional changes that fixed it. It’s a mystery now!