0

I am trying to deploy web application on multi-docker environment using Elasticbeanstalk, and I am using authentication file stored in S3 bucket for repository authentication. But I got the pullcontainer error as below all the time.

'ECS task stopped due to: Task failed to start. (server: CannotPullContainerError: Error response from daemon: pull access denied for test/image, repository does not exist or may require '''docker login''': denied: requested access to the resource is denied

I tried to switch to the Docker Amazon Linux 2 platform to test, on which with the same authentication file and one of the private images, elasticbeanstalk is possible to pull the image from docker hub.

The authentication file '.dockercfg' looks like below,

{
    "auths": {
        "https://index.docker.io/v1/": {
            "auth": "base64(USERNAME:PASSWORD)"
        }
    },
    "HttpHeaders": {
        "User-Agent": "Docker-Client/18.09.7 (linux)"
    }
}

The Dockerrun.aws.json file,

{
  "AWSEBDockerrunVersion": 2,
    "authentication": {
      "bucket": "[bucket location]",
      "key": ".dockercfg"
    },
  "containerDefinitions": [
        {
      "name": "test1",
      "image": "test/image1",
      "hostname": "test1",
      "essential": false,
      "memory": 256,
      "links" : ["test"]
    },
    {
      "name": "test2",
      "image": "test/image2",
      "hostname": "test2",
      "memory": 256,
      "essential": false
    },
    {
      "name": "test3",
      "image": "test/image3",
      "hostname": "test3",
      "essential": true,
      "memory": 128,
      "portMappings": [
        {
          "hostPort": 80,
          "containerPort": 80
        }
      ],
      "links" :["test"]
    }
  ]
}

All the 3 images are private and from the same repository. I also tried to switch all of them to public, and the same Dockerrun.aws.json file works. Once I set any of them to private, Elatiscbeanstalk will entounter the cannotpullimage issue.

What's wrong? How can the same authentication file work for the single docker environment but not for the multi-env?

1 Answers1

0

Somehow I got the problem solved.

Right now the Elasticbeanstalk Multicontainer Docker platform only supports the Amazon Linux AMI operating system. The authorization file required by Amazon Linux AMI is different from the one for Amazon Linux 2.

The authorization file looks like,

 {
    "server" :
    {
      "auth" : "auth_token",
      "email" : "email"
    }
}

Details can be found in the documentation https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.container.console.html#docker-alami