Segmentation fault in Docker build command with NPM install


I’m experiencing segmentation fault in Docker build command in EC2 instance having Ubuntu. When it comes to RUN command with NPM install it will give a segmentation fault. I also looked at storage space as I read about segmentation signal "A process that tries to read and write memory its not allowed to access. The kernal will normally terminate the process".

My Dockerfile is looking like this.

FROM node:12.18.1 

WORKDIR /deployment-001/service
COPY package.json .
RUN npm install
COPY . .


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

I attaching the storage space screenshot which clearly says it has a lot of memory to write. Storage space

Please correct me if I’m wrong anywhere.

I also made a screenshot of docker build command which is giving me segmentation fault.

Segmentation fault

Please help me if I’m wrong about linux storage space or if I’m missing something about segmentation fault.

NOTE: At first I have only 8GB of storage space then I expanded the EBS volume.



I don’t know why it worked but it was solved in this way to include –no-cache option in docker build command.

I just used "–no-cache" option in docker build command, it didn’t show segmentation error anymore.

Answered By – Ahsan Danish

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published