I'm deploying a docker image to ElasticBeanstalk (using a CodePipeline). My Dockerrun.aws.json looks like this:
{
"AWSEBDockerrunVersion": "1",
"Authentication": {
"Bucket": "mybucket",
"Key": "docker_hub_auth.json"
},
"Image": {
"Name": "repo/image:tag",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "8080"
}
]
}
And I'm getting error from ElasticBeanstalk instance: Failed to pull Docker image repo/image:tag: Error response from daemon: pull access denied for repo/image, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. Check snapshot logs for details. (Executor::NonZeroExitStatus)
When I ssh to the instance, I can check that the auth file docker_hub_auth.json is being successfully downloaded. What surprises me is, that the file is downloaded to /root/.dockercfg (from 03build.sh via download_auth.py). Then docker pull is invoked. But I assume the docker expects the auth in /root/.docker/config.json!
When I manually do docker login on the instance, it adds the Docker Hub auth to the /root/.docker/config.json and deploy starts working. But obviously I need to make it work without the manual docker login in case my instance is replaced or a new instance started.
It seems like a bug to me. What can I do? Automated scripts download auth to /root/.dockercfg but the docker (Docker version 19.03.6-ce, build 369ce74) needs it in /root/.docker/config.json. Any advice how to overcome it?
UPDATE, SOLVED
A have moved to Amazon Linux 2 and now it works.