【发布时间】:2022-02-06 03:41:03
【问题描述】:
我对 docker 很陌生,我有一个 docker 文件,其中包含构建 docker 映像的所有说明。该映像必须部署在 AWS Fargate 集群中。现在我有一个执行以下操作的 python 脚本:
1. clone a repo from GitHub
2. Locate the docker file, build the image and push the docker image to AWS ecr
3. Create a task definition and deploy into ECS fargate cluster
4. Additionally the script generate a YAML file based on certain logic that has certain parameters(not related to container config) which is required for the application
如何在容器开始在 AWS 中运行之前使该文件内容可供容器使用? 我正在检查--entrypoint 和--cmd,但在这里我无法更改Dockerfile
【问题讨论】:
-
您试图“在容器开始运行之前使其可用”的具体文件是什么? YAML 文件?真的不清楚你在问什么。
-
@MarkB 该文件包含一些从脚本动态生成的信息,并且 yaml 文件必须在运行时可用。我认为在 Fargate 服务中部署时,该文件必须存在于容器中。有什么方法可以在不更改 Dockerfile 的情况下实现这一目标?
-
@Daniel Farrell 我说错了。正确的! Fargate 正在使用任务定义从 ecr 中提取图像。基本上动态生成的文件需要在运行时可用。
-
听起来您需要更改 Dockerfile 以将 YAML 文件包含在容器中。否则,您需要将文件放在 S3 之类的地方,并让您的应用程序在启动时从那里拉取它。您可以使用 EFS 进行路径映射,但每次文件更改时都很难将文件放到 EFS 上。
标签: docker amazon-ecs