首页 > 解决方案 > 无法使用 docker hub 私有存储库映像注册 ecs 任务

问题描述

我想使用来自私有 docker hub 存储库的 docker 映像运行 ECS 任务。

我遵循了此文档https://docs.aws.amazon.com/AmazonECS/latest/developerguide/private-auth.html中的所有说明。

然后我创建了一个任务定义json:

{
  "containerDefinitions": [
    {
      "name": "signage-next-graphql",
      "image": "docker.io/private/next-graphql:latest",
      "repositoryCredentials": {
        "credentialsParameter": "arn:aws:secretsmanager:us-east-2: 385945872227:secret:dockerhub-personal-pTsU9e"
      },
      "memory": 500,
      "essential": true,
      "portMappings": [
        {
          "hostPort": 5000,
          "containerPort": 5000
        }
      ]
    }
  ],
  "volumes": [],
  "memory": "900",
  "cpu": "128",
  "placementConstraints": [],
  "family": "next-graphql",
  "executionRoleArn": "arn:aws:iam::385945872227:role/ecsTaskExecutionRole",
  "taskRoleArn": ""
}

当我运行时aws ecs register-task-definition --family "${ECS_TASK_FAMILY}" --cli-input-json "file://./ecsTaskDefinition.json" --region "${AWS_TARGET_REGION}",我得到了错误;

containerDefinitions[0] 中的未知参数:“repositoryCredentials”,必须是以下之一:name、image、cpu、memory、memoryReservation、links、portMappings、essential、entryPoint、command、environment、mountPoints、volumesFrom、linuxParameters、hostname、user、workingDirectory , disableNetworking, privileged, readonlyRootFilesystem, dnsServers, dnsSearchDomains, extraHosts, dockerSecurityOptions, dockerLabels, ulimits, logConfiguration, healthCheck

aws 文档没有更新吗?我希望它是最新的。

标签: amazon-ecs

解决方案


推荐阅读