如何删除 Amazon Elastic Container Service - ECS 中现有的 Docker 卷(数据卷)?

How can I delete an existing Docker Volume (Data Volume) in Amazon Elastic Container Service - ECS?

我目前在 Amazon ECS 中有一个 Nginx Docker 映像。我需要通过 certbot 重新颁发 SSL 证书,并且需要删除旧证书。如何删除卷?我目前打算使用新卷而不是旧卷(附加 "v2" 后缀)。

这是我的任务定义的一部分(如上所述,我不得不将它们重新命名为 v2):

"mountPoints": [
                {
                    "sourceVolume": "nginx-certbot-v2",
                    "containerPath": "/etc/letsencrypt",
                    "readOnly": false
                },
                {
                    "sourceVolume": "nginx-acme-webroot-v2",
                    "containerPath": "/var/acme-webroot",
                    "readOnly": false
                },
                {
                    "sourceVolume": "nginx-dhparam-v2",
                    "containerPath": "/etc/nginx/dhparam",
                    "readOnly": false
                }
            ],

这是卷定义:

"volumes": [
      {
          "name": "nginx-certbot-v2",
          "dockerVolumeConfiguration": {
              "scope": "shared",
              "autoprovision": true,
              "driver": "local"
          }
      },
      {
          "name": "nginx-acme-webroot-v2",
          "dockerVolumeConfiguration": {
              "scope": "shared",
              "autoprovision": true,
              "driver": "local"
          }
      },
      {
          "name": "nginx-dhparam-v2",
          "dockerVolumeConfiguration": {
              "scope": "shared",
              "autoprovision": true,
              "driver": "local"
          }
      }
  ]

如果没有 "v2",我是否有可能取回卷?

将 docker 卷的范围定义为任务而不是共享,它将在任务停止后自动删除。

"volumes": [
{
    "name": "scratch",
    "dockerVolumeConfiguration" : {
        "scope": "task",
        "autoprovision": true,
        "driver": "local",
        "labels": {
            "scratch": "space"
        }
    }
}

]

参考这个link了解更多信息

ECS docker volume reference