docker build failed on npm install, reason: connect ECONNREFUSED

  docker, node.js, ubuntu

I’m having a hard problem getting my Docker container up, it shows some weird error in the console, I’m zero clues about it as I’m a newbie:


FROM node:14

WORKDIR /usr/src/app/

COPY package.json package.json
COPY server.js server.js

RUN ping -c 4
RUN  npm config set registry
RUN echo "${http_proxy}" && echo "${HTTP_PROXY}" 

RUN npm install
# COPY . .


CMD ['npm', 'start']

When I run the docker build command

$ docker build -t myapp .

The error I’m getting:

enter image description here

enter image description here

I’m on Ubuntu 20.4 and it is just a simple node app with a server.js file. let me know if you need anything else from me to get it fixed. Thank you in advance for your help!

Source: Docker Questions