Docker Community Forums

Share and learn in the Docker community.

Docker image build error

I get this error when trying to build a docker image from the docker file. Whats causing the registry from not being able to get accessed.

[5/5] RUN npm install:
#9 3.685 npm WARN developing-with-docker@1.0.0 No description
#9 3.687 npm WARN developing-with-docker@1.0.0 No repository field.
#9 3.688
#9 3.695 npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
#9 3.696 npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
#9 3.697 npm ERR! request to https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz failed, reason: self signed certificate in certificate chain
#9 4.502
#9 4.502 npm ERR! A complete log of this run can be found in:
#9 4.502 npm ERR! /root/.npm/_logs/2021-10-13T04_35_46_746Z-debug.log


executor failed running [/bin/sh -c npm install]: exit code: 1

Below id the Dockerfile script

FROM node:13-alpine

ENV MONGO_DB_USERNAME=admin
MONGO_DB_PWD=password

RUN mkdir -p /home/app

COPY ./app /home/app

set default dir so that next commands executes in /home/app dir

WORKDIR /home/app

will execute npm install in /home/app because of WORKDIR

RUN npm install

no need for /home/app/server.js because of WORKDIR

CMD [“node”, “server.js”]