Search code examples
amazon-web-servicesdockeramazon-ecs

aws ecs 403 error to login private registry


I am trying to login to Quay with ECS.
Quay is a private registry docker.

I followed this documentation but I have also a 403 error: "{\"error\": \"Permission Denied\"}".

I put this code in /etc/ecs/ecs.config:

ECS_ENGINE_AUTH_TYPE=docker
ECS_ENGINE_AUTH_DATA={"https://quay.io/": { "username": "xxxxxx","password":"xxxxx","email": "."}}

And I've reboot the ecs services but it's not working.

Have you got an idea ?


Solution

  • The documentation points out to a slightly different content of /etc/ecs/ecs.conf:

    ECS_ENGINE_AUTH_TYPE=dockercfg
    ECS_ENGINE_AUTH_DATA={"https://quay.io": {"auth": "YOURAUTHTOKENFROMDOCKERCFG", "email": "[email protected]"}}
    

    It uses dockercfg and a token rather than username/password.

    The dockercfg is described in the documentation page "I'm authorized but I'm still getting 403s"

    docker stores the credentials it uses for push and pull in a file typically placed at $HOME/.dockercfg.

    If you are executing docker in another environment (scripted docker build, virtual machine, makefile, virtualenv, etc), docker will not be able to find the .dockercfg file and will fail.

    As the OP Mathieu Perochon comments below, this is also linked to the environment version of the Amazon Machine Image:

    I have upgrade my AMI (Amazon ECS-Optimized Amazon Linux) and it's working