Can't push image to Amazon ECR - fails with “no basic auth credentials”

后端 未结 30 2124
旧巷少年郎
旧巷少年郎 2020-12-02 05:07

I\'m trying to push a docker image to an Amazon ECR registry. I\'m using docker client Docker version 1.9.1, build a34a1d5. I use aws ecr get-login --regi

30条回答
  •  猫巷女王i
    2020-12-02 05:39

    For Mac OSX

    TL;DR Make sure your "auths" key matches your credential store key exactly

    • Check your docker config:

    cat ~/.docker/config.json

    Sample Result:

    {
        "auths": {
            "https://55511155511.dkr.ecr.us-east-1.amazonaws.com": {}
        },
        "HttpHeaders": {
            "User-Agent": "Docker-Client/19.03.5 (darwin)"
        },
        "credsStore": "osxkeychain"
    }
    

    Notice that the "auths" value is an empty object and docker is using a credential store "osxkeychain".

    • Open Mac's "Keychain Access" app and find the name "Docker Credentials"

    Notice the Where: field

    • Make sure the auths key in ~/.docker/config.json matches the Where: field in Keychain Access.

    If the auths key in ~/.docker/config.json does NOT match they Where: field in the keychain, you may get a Login Succeeded from docker login... but still get ERROR: Service 'web' failed to build: Get https://55511155511.dkr.ecr.us-east-1.amazonaws.com/v2/path/to/image/latest: no basic auth credentials when you try to pull.

    In my case, I needed to add https://

    Original

        "auths": {
            "55511155511.dkr.ecr.us-east-1.amazonaws.com": {}
        },
    

    Fixed

        "auths": {
            "https://55511155511.dkr.ecr.us-east-1.amazonaws.com": {}
        },
    

提交回复
热议问题