I am using docker on my server which is Ubuntu 16.04.2 LTS.
My Docker version 18.03.0-ce, build 0520e24.
Since, my app inside the docker container was not able to listen to port 8443 which I was using for https, I started fiddling with docker and its port mappings. I can’t remember everything that we tried, but the last commands before it got messed was :-
docker run -p 127.0.0.1:443:8443/tcp container_name bash
docker run -p 127.0.0.1:8443:8443/tcp container_name bash
Now, whenever I build my docker image using the command like :-
docker build -t name:tag -f ./Dockerfile-server .
it breaks down at npm install
with the following error :-
Step 3/13 : WORKDIR /server
Removing intermediate container 744d734f9687
---> ad1cc4b236a4
Step 4/13 : COPY server/package.json /server
---> 5a9cfde25548
Step 5/13 : RUN npm install
---> Running in 7c78745fb509
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://registry.npmjs.org/body-parser failed, reason: connect ECONNREFUSED 104.16.22.35:443
npm ERR! at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
I am not behind any proxy. Any help will be appreciated.