Docker: Stderr:fatal error: runtime: out of memory on AWS Elasticbeanstalk

0

Each time I am trying to build and deploy my React Project on AWS Elastic Beanstalk using Docker, I am getting this error:

Stderr:fatal error: runtime: out of memory

The project is the basic react project and nothing more, serving it via nginx. What might be the reason of this error? And how do I resolve it. Please note, I have emptied my S3 bucket and have restarted the appServer too, to try and resolve any unnecessary memory or cache use. And I am able to successfully build and run this file locally. The logs are as follows:

Step 1/9 : FROM node:alpine as builder
 ---> eb56d56623e5
Step 2/9 : WORKDIR '/app'
 ---> Using cache
 ---> 41d7415dae07
Step 3/9 : COPY package.json .
 ---> Using cache
 ---> 95877ba9972c
Step 4/9 : RUN npm install
 ---> Using cache
 ---> c366758de80f
Step 5/9 : COPY . .
 ---> 5697eace7031
Step 6/9 : RUN npm run build
 ---> Running in 52cc1a3e6ac0

> react-project-frontend@0.1.0 build
> react-scripts --openssl-legacy-provider build

Creating an optimized production build...

2022/03/03 13:14:45.346275 [WARN] failed to execute command: docker build -t aws_beanstalk/staging-app /var/app/staging/, retrying...
2022/03/03 13:14:45.425369 [INFO] Running command /bin/sh -c docker build -t aws_beanstalk/staging-app /var/app/staging/
2022/03/03 13:14:47.001398 [ERROR] An error occurred during execution of command [app-deploy] - [Docker Specific Build Application]. Stop running the command. Error: failed to build docker image: Command /bin/sh -c docker build -t aws_beanstalk/staging-app /var/app/staging/ failed with error exit status 2. Stderr:fatal error: runtime: out of memory
asked 9 months ago306 views
2 Answers
0

Does node:alpine have npm installed by default? Maybe you need to install npm before running your npm install command?

answered 9 months ago
  • Yes. Node alpine has npm installed by default. Also, my docker file is successfully built on my local system.

0

Hello From Step2 to Step 4 is using cache try to clear them and re-run

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions