ECS 没有足够的空闲数据块用于 docker 图像。如何配置足够volume/storage?

ECS doesn't have enough free data blocks for docker image. How to provision enough volume/storage?

我用 Terraform 管理我们的 ECS 任务,一切都很好,但最近,当任务试图从 ECR 获取图像时,我 运行 遇到了这个错误:

CannotPullContainerError: failed to register layer: devmapper: Thin Pool has 4143 free data blocks which is less than minimum required 4449 free data blocks. Create more free space in thin pool or use dm.min_free_space option to change behavior

我对要更新的内容有点困惑。我们的 ECS 服务使用 EC2 启动类型,但我认为我对这里发生的事情存在根本性的误解。阅读 https://docs.aws.amazon.com/AmazonECS/latest/developerguide/CannotCreateContainerError.html 似乎是因为卷太小,但 AWS 帮助页面建议 docker prune。这让我感到困惑,因为据我所知,ECS 任务每次都可以访问整个卷作为一个新的开始——为什么卷上会有陈旧的 images/containers?或者该页面只是建议在您的 ECS 任务可能获取过多图像的情况下,您应该删除陈旧的图像。

除此之外,我不确定如何进行。会增加 aws_ecs_task_definition 中的 ephemeral_storage 帮助吗,或者我是否需要管理我自己的卷,该卷附加到 aws_launch_template 实例,该实例与 aws_autoscaling_group 相关联aws_ecs_service

只需将此块添加到我的 aws_launch_template

resource "aws_launch_template" "instance" {
  ...
  block_device_mappings {
    device_name = "/dev/xvdcz"

    ebs {
      volume_size           = 50
      delete_on_termination = true
    }
  }

}