每次我试图使用Docker在AWS弹性豆柄上构建和部署我的时,我都会得到以下错误:
Stderr:fatal error: runtime: out of memory该项目是基本的react项目,而不是更多的,通过nginx为其服务。这一错误的原因可能是什么?我该怎么解决这个问题。请注意,我已经清空了我的S3桶并重新启动了appServer,以尝试解决任何不必要的内存或缓存使用问题。我能够在本地成功地构建和运行这个文件。日志如下:
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发布于 2022-03-03 14:47:26
您的停靠映像没有分配足够的内存:
在ElasticBeanstalk应用程序环境Dockerrun.aws.json中,您可以增加内存分配("memory": 80到例如"memory": 100):
"containerDefinitions": [
{
"name": "request_repeater",
"image": "my/image",
"essential": true,
"memory": 80, <- change this另外,您可能需要更改实例类型。例如,t2.nano的最大内存为0.5 GB
在创建应用程序时,可以在修改容量设置中这样做,也可以在当前env配置上在配置中编辑>容量设置。
https://stackoverflow.com/questions/71337901
复制相似问题