AWS and Docker Authorized Issues

Overview

In some cases, you may get errors when trying to authorize Docker and the AWS CLI. 

These errors are, but not limited to:

Error saving credentials: error storing credentials - err: exit status 1, out: `not implemented`
Your authorization token has expired

Problem:

When authenticating to AWS, you may run into an issue where it errors out due to any reason. This can sometimes be attributed to a stale Docker config and/or a stale AWS credentials config.

Solutions:

  • Solution - Removing cached configuration files
    • Two likely sources of this error are the Docker config.json and/or AWS credentials files when cached or persisted on a self-hosted runner. 

      You can add run the following code snippet at the beginning of your job to remove these files.

      - run:
          name: Remove config and credential files
          command: |
            if [ -f "$HOME/.docker/config.json" ]; then
              rm -f ~/.docker/config.json
            fi
      
            if [ -f "$HOME/.aws/credentials" ]; then
              rm -f ~/.aws/credentials
            fi
      

      Following that, you can then proceed to authenticate by using a command such as the aws-ecr orb's ecr-login command.

Outcome:

The stored credentials will be cleared, and you can then authenticate via the aws cli with the correct credentials.

Additional Resources:

Was this article helpful?
0 out of 2 found this helpful

Comments

0 comments

Article is closed for comments.