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 . .
EXPOSE 1883
CMD ["node","service.js"]
I attaching the storage space screenshot which clearly says it has a lot of memory to write.
Please correct me if I’m wrong anywhere.
I also made a screenshot of docker build command which is giving me 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.
Thanks
2
Answers
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.
t2.micro only have 1 GB RAM, which is not enough for NPM build. Change to t2.small. This is a common issue for people using NodeJS but wants to save cost by using t2.micro. Spend some money so that you will not face this kind of issue in the future