Sim*_*mer 17 amazon-ecs docker amazon-elastic-beanstalk
我正在努力将我的构建部署到 Docker 上的 AWS。我不知道解决方案在哪里,因为这是我第一次使用 Docker。我在本地一切正常,但是当我部署时,我在 Elastic Beanstalk 中收到以下错误:
2020/04/30 05:35:02.330900 [ERROR] An error occurred during execution of command [app-deploy] - [Docker Specific Build Application]. Stop running the command. Error: failed to pull docker image: Command /bin/sh -c docker pull node:13.3.0 AS compile-image failed with error exit status 1. Stderr:"docker pull" requires exactly 1 argument.
See 'docker pull --help'.
Run Code Online (Sandbox Code Playgroud)
这是我的 Docker 文件的样子:
FROM node:13-alpine as builder
WORKDIR /opt/ng
COPY package.json package-lock.json ./
RUN npm install
ENV PATH="./node_modules/.bin:$PATH"
COPY . ./
RUN ng build --prod
FROM nginx:1.18-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /opt/ng/dist/angular-universal-app/browser /usr/share/nginx/html
Run Code Online (Sandbox Code Playgroud)
有人可以指出我正确的方向吗?还是 Elastic Beanstalk 的 Docker 版本不支持这种多阶段构建方法?
Alf*_*tri 23
我有同样的问题。实际上,我检查了日志文件中的以下行:
2020/05/26 17:26:30.327310 [INFO] Running command /bin/sh -c docker pull node:alpine as builder
2020/05/26 17:26:30.369280 [ERROR] "docker pull" requires exactly 1 argument.
Run Code Online (Sandbox Code Playgroud)
如您所见,它尝试使用 3 个参数创建“docker pull”:
当然,这是不可能的,因为它只需要 1 个参数。因此,显然 AWS Elastic Beanstalk 不支持阶段命名。出于这个原因,我使用未命名的构建器解决了:
FROM node:13-alpine
Run Code Online (Sandbox Code Playgroud)
最后:
COPY --from=0 /opt/ng/dist/angular-universal-app/browser /usr/share/nginx/html
Run Code Online (Sandbox Code Playgroud)
最终的 Dockerfile:
FROM node:13-alpine
WORKDIR /opt/ng
COPY package.json package-lock.json ./
RUN npm install
ENV PATH="./node_modules/.bin:$PATH"
COPY . ./
RUN ng build --prod
FROM nginx:1.18-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=0 /opt/ng/dist/angular-universal-app/browser /usr/share/nginx/html
Run Code Online (Sandbox Code Playgroud)
对我来说,它可以使用该解决方案。如果有人有任何问题,请分享最后 100 行日志
我在使用使用“Amazon Linux 2”的解决方案堆栈时看到了此错误。这些平台是新的,并且存在一些持续的问题。
Amazon Linux 2 对 AWS Elastic Beanstalk 的支持是测试版,可能会发生变化。
请使用名称中包含“Amazon Linux”的解决方案堆栈。你不应该在那里面对这个问题。
| 归档时间: |
|
| 查看次数: |
3562 次 |
| 最近记录: |