【问题标题】:AWS Beanstalk failed to deploy Docker Node(React) appAWS Beanstalk 无法部署 Docker Node(React) 应用程序
【发布时间】:2021-12-16 11:41:49
【问题描述】:

我正在将 Dockerized React 应用程序部署到 AWS Beanstalk。
(类型:t2.micro / Docker 在 64 位 Amazon Linux 2 上运行)
当我在本地运行时,我的 docker 映像可以工作。(docker run -p 3001:3000 -d todo-app)
但是当我尝试部署 (eb deploy) 时,失败并显示错误消息:

ERROR: ServiceError - Failed to deploy application.
(来自下面的 eb-engine.log:)
[ERROR] An error occurred during execution of command [app-deploy] - [Run Docker Container]. Stop running the command. Error: open file failed with error open /opt/elasticbeanstalk/deployment/.aws_beanstalk.current-container-id: no such file or directory

这是我的 Dockerfile(非常简单):

FROM node:14-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

这是我的 Package.json(如果有帮助的话)

{
  "name": "todo-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.12.3",
    "@material-ui/icons": "^4.11.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.3.0",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "GENERATE_SOURCEMAP=false react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

请给我一些提示是什么导致错误?

【问题讨论】:

    标签: node.js amazon-web-services docker amazon-elastic-beanstalk


    【解决方案1】:

    没有找到明确的原因,但有两种解决方案。

    解决方案 1:从 Docker running on 64bit Amazon Linux 2 更改平台
    Docker running on 64bit Amazon Linux (Deprecated)

    解决方案 2: 将 Node.js 版本从 14 更新到 16。
    (在 Dockerfile 中将 FROM node:14-alpine 更改为 FROM node:16-alpine

    【讨论】:

      猜你喜欢
      • 2020-07-26
      • 2020-08-26
      • 2021-03-01
      • 2019-03-07
      • 2016-08-26
      • 2018-07-13
      • 2018-12-31
      • 2017-03-25
      • 2016-07-02
      相关资源
      最近更新 更多