简体   繁体   中英

Using Amazon ECS with google container registry

When I try to use AWS ECS with private google container registry my task always in pendings state. According to AWS docs I add env variables in container definition

ECS_ENGINE_AUTH_TYPE=dockercfg
ECS_ENGINE_AUTH_DATA=
{"https://eu.gcr.io": {
    "email": "not@val.id", 
    "auth": "some hash"
  }}

But I get this error

"CannotPullContainerError: Error: image not found"

My full task definition

{
  "requiresAttributes": [],
  "taskDefinitionArn": "arn:aws:ecs:eu-west-1:745964170259:task-definition/test:2",
  "status": "ACTIVE",
  "revision": 2,
  "containerDefinitions": [
    {
      "volumesFrom": [],
      "memory": 128,
      "extraHosts": null,
      "dnsServers": null,
      "disableNetworking": null,
      "dnsSearchDomains": null,
      "portMappings": [
        {
          "hostPort": 80,
          "containerPort": 80,
          "protocol": "tcp"
        }
      ],
      "hostname": null,
      "essential": true,
      "entryPoint": null,
      "mountPoints": [],
      "name": "nginx_test",
      "ulimits": null,
      "dockerSecurityOptions": null,
      "environment": [
        {
          "name": "ECS_ENGINE_AUTH_TYPE",
          "value": "dockercfg"
        },
        {
          "name": "ECS_ENGINE_AUTH_DATA",
          "value": "{\"https://eu.gcr.io\":{\"auth\":\"somehash\",\"email\":\"not@val.id\"}}"
        }
      ],
      "links": null,
      "workingDirectory": null,
      "readonlyRootFilesystem": null,
      "image": "eu.gcr.io/project_id/image_name",
      "command": null,
      "user": null,
      "dockerLabels": null,
      "logConfiguration": null,
      "cpu": 0,
      "privileged": null
    }
  ],
  "volumes": [],
  "family": "test"
}

What is right task definition for this case?

The ECS_ENGINE_AUTH_TYPE and ECS_ENGINE_AUTH_DATA environment variables should be specified for the ECS Agent, not specified in your task definition. The documentation has instructions on how to use private registries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM