I'm encountering a consistent issue with Docker builds freezing after approximately 150 seconds on an AWS EC2 instance. I have started to face this issue from today only, as till yesterday everything was perfect fine.Quick overview of my problem:
- The Docker build process runs for about 160 seconds before freezing.
- The freeze occurs during the RUN npm run build-dev step.
- No specific error messages are displayed, and the process just hangs.
Screenshot of the process when it hangs
Below are the details of my setup.
Environment:
- Instance Type: t3.medium (2 vCPUs, 4 GiB Memory)
- OS: Ubuntu 20.04 LTS
- Docker Version: 20.10.8
Dockerfile
FROM node:lts-alpine as build-stageWORKDIR /appCOPY package*.json ./RUN npm install --legacy-peer-depsCOPY . .RUN npm run build-dev# production stageFROM nginx:stable-alpine as production-stageCOPY --from=build-stage /app/build /var/wwwCOPY nginx.conf /etc/nginx/nginx.confEXPOSE 3000CMD ["nginx", "-g", "daemon off;"]
The command I am running to build the image:
docker build -t imagename .
What I've tried to resolve the issue?
- Monitored CPU and memory usage using top
- Reviewed Docker daemon logs
- Used verbose logging in Docker build
- Ensured stable network connectivity
- Every other solution I can find on stackoverflow, docker support, and in general the web.