By udbasili
I am using the 5 dollar plan to host mongodb, nginx, react node through docker and docker compose. The problem I have is that it keeps giving me
The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
This image building starts with the backend and then react where this error occurs. The specific line it occurs is at
Step 5/9 : RUN yarn build
---> Running in e12af022dcf1
yarn run v1.22.5
$ react-scripts build
Creating an optimized production build...
I am using the multi-stage docker build for react and nginx
FROM node:alpine as build
WORKDIR /usr/app
COPY ./client .
RUN yarn install
RUN yarn build
FROM nginx:alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build /usr/app/build /usr/share/nginx/html
``
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I had the very same problem. Though we are using kubernetes (not docker compose), but the issue may be the same. So, in my case it was the problem of too few resources allocated to the pod through kubernetes config files. After I added a bit more CPU and memory it started to build. It was this:
resources:
limits:
memory: '1024Mi'
cpu: '1'
requests:
memory: '64Mi'
cpu: '100m'
And I changed that to:
resources:
limits:
memory: '4096Mi'
cpu: '2'
requests:
memory: '128Mi'
cpu: '300m'
Hopefully it will be useful to somebody.
Hello there,
I will recommend you to inspect the memory usage using top , htop or sar and see if the memory usage is indeed high during the process.
You can also check the logs and see if there were killed processes and if the server was out of memory. In order to do that you can run the following commands
- grep -i memory /var/log/messages
- grep -i kill /var/log/messages
Regards, Alex
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.