【发布时间】:2022-08-23 00:41:57
【问题描述】:
我的 Dockerfile 很简单,代码如下。它是一个 Angular 应用程序。将代码合并到我的主分支 CodePipeline 接管后,CodeBuild 将构建映像并推送到 ECR,CodeDeploy 将使用该映像部署 ECS Fargate 任务。一切正常。但此图像有 1 个严重漏洞。 CVE-2021-22945 - curl
node14:14182alpine312 基本构建自:FROM node:14.18.2-alpine3.12 nginx:latest 是从 FROM nginx:latest 构建的
FROM <awsaccountid>.dkr.ecr.<region>.amazonaws.com/node14:14182alpine312 as builder
WORKDIR /app
COPY ./hello-world-web/ /app/
RUN apk add --no-cache git
RUN npm install
RUN npm run build
FROM <awsaccountid>.dkr.ecr.<region>.amazonaws.com/nginx:latest
COPY --from=builder /app/dist/hello-world-web /usr/share/nginx/html
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
扫描 ECR Repo 的工具提到该漏洞位于第 0 层。我可以在构建可以修复此问题的映像时运行任何脚本吗?单独的节点和 nginx 映像没有此严重漏洞。似乎可以在运行 npm install 时引入它。非常感谢任何补救此问题的帮助。
标签: docker security dockerfile