Skip to content

Login to cross-account ECR registry not working with AWS CLI v1 / ubuntu < 20 #39

Description

@michaelb990

Behaviour

Logging into a registry in a different AWS account doesn't work when using CLI v1, with the get-login command.

Steps to reproduce this issue

  1. Create a user in ACCOUNT A
  2. Create a repository in ACCOUNT B
  3. Grant the user in ACCOUNT A permission to access the repository in ACCOUNT B
  4. Run docker/login-action with credentials from ACCOUNT A and try to push/pull an image from ACCOUNT B

Expected behaviour

Should work fine

Actual behaviour

Access denied

Configuration

name: Main Workflow

on:
  push:
    branches:
      - master

jobs:
  build:
    name: Build & push image
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v1

      - name: Login to ECR
        uses: docker/login-action@v1
        with:
          registry: 085895507678.dkr.ecr.us-west-2.amazonaws.com
          username: ${{ secrets.AWS_ACCESS_KEY }}
          password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

      - name: Build and push
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: 085895507678.dkr.ecr.us-west-2.amazonaws.com/docker-login-test:latest

Logs

See build link.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions