ECS集群中的每个任务是否都有自己的磁盘space?

Does each task in an ECS cluster get its own disk space?

我设置了 ECS 集群。我可以启动几个都指向相同任务定义的任务,我看到它们 运行 不同的容器运行时 ID。

我明白Each Fargate task has its own isolation boundary and does not share the underlying kernel, CPU resources, memory resources, or elastic network interface with another task.

我想了解的是每个任务是否也有自己的磁盘space?假设我将日志附加到静态文件 (logs/application_logs.txt)。每个 运行 任务在该文件中是否只有自己的日志?

如果 3 个任务 运行 放在一起,所有 3 个任务的日志最终都会在 logs/application_logs.txt 中吗?

引用文档:

When provisioned, each Fargate task receives the following storage. Task storage is ephemeral. After a Fargate task stops, the storage is deleted.

  • 10 GB of Docker layer storage
  • An additional 4 GB for volume mounts. This can be mounted and shared among containers using the volumes, mountPoints and volumesFrom parameters in the task definition.

是的,如果您在任务定义的 volumes 部分配置了存储,那么您的任务将获得非持久性存储。

如果您要将日志附加到一个文件并且有 3 个任务 运行 那么我想他们每个人都会有自己的日志文件。

What I want to understand is does each task gets its own disk space as well? Suppose I append logs to a static file (logs/application_logs.txt). Will each running task only have its own logs in that file?

每个 fargate 任务都分配了自己的存储 space。这是任务所独有的。每个 运行 任务只会在该特定位置有自己的日志。

If 3 tasks are running together, will the logs of all 3 tasks end up in >logs/application_logs.txt?

不,他们不会。如果需要,您可以将数据卷添加到可以在多个任务之间共享的任务。有关详细信息,请参阅 https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html