Reputation: 11
Docker containers on WSL not connected to the internet when launched with "sudo dockerd --iptables=false". "npm ERR! request to https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org"
I am facing connectivity issues with Docker containers on Windows Subsystem for Linux (WSL) when I launch Docker using the command "sudo dockerd --iptables=false". Specifically, I am trying to run an Angular project, and during the "npm install" step, I encounter the following error: "npm ERR! request to https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org".
Here is my Dockerfile:
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
# Install node_modules
RUN npm install
# Bundle app source
COPY . .
EXPOSE 8080
# Run the project
CMD [ "npm", "run", "start-dev" ]
And my docker-compose.yml:
version: '3'
services:
frontend:
build:
dockerfile: Dockerfile
context: .
container_name: frontend
ports:
- 8083:8080
volumes:
- /usr/src/app/node_modules
- ./:/usr/src/app
environment:
- DEV_HOST=0.0.0.0
When I launch the project using sudo docker compose up --build, the containers start successfully. However, during the "npm install" step, I encounter the aforementioned error related to connectivity with the npm registry (https://registry.npmjs.org).
I have noticed that this issue occurs when launching Docker with the command "sudo dockerd --iptables=false". Is there a known reason why Docker containers on WSL might not have internet connectivity under these conditions? How can I resolve this issue and ensure that my Docker containers can access the internet properly?
Thank you for your assistance.
Upvotes: 1
Views: 1171