Docker Plugin - Unable to install node dependencies

Hi there,

I am running CI against a simple nodejs application. Docker plugin is able to pull the base image from the internet but unable to install npm dependencies.

Following is the error:

Step 4/15 : RUN npm install -g nodemon
 ---> Running in c37a276211d4
time="2020-09-08T14:03:52.578028565Z" level=info msg="No non-localhost DNS nameservers are left in resolv.conf. Using default external servers: [nameserver 8.8.8.8 nameserver 8.8.4.4]"
time="2020-09-08T14:03:52.578470552Z" level=info msg="IPv6 enabled; Adding default IPv6 external servers: [nameserver 2001:4860:4860::8888 nameserver 2001:4860:4860::8844]"
time="2020-09-08T14:03:52.606222830Z" level=info msg="shim containerd-shim started" address="/containerd-shim/moby/c37a276211d40ccebbf7b53f797c5c53d818b359cc224ec7bc823c9071e2be1a/shim.sock" debug=false pid=311 
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/nodemon failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443

Dockerfile

FROM node:8.9-alpine

RUN mkdir -p /app
WORKDIR /app

RUN npm install -g nodemon
RUN npm config set registry https://registry.npmjs.org
COPY package.json /app/package.json
RUN npm install \
 && npm ls \
 && npm cache clean --force \
 && mv /app/node_modules /node_modules
COPY . /app

ENV PORT 80
EXPOSE 80

CMD ["node", "server.js"]

It looks like some network issues or additional network configuration for drone.

Not able to figure out the solution.

Do you need to specify a custom dns? Or if you are running Drone on Kubernetes do you need to set mtu? I searched for existing threads with the "No non-localhost DNS nameservers are left in resolv.conf" error message and found this solution:

Your reply makes more sense because there is no issue for pulling the base image from internet but in second layer that tries to connect to internet for pulling packages looks to have issues with connecting to internet. Thank a lot for help.