Skip to content

Conversation

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Jan 6, 2026

follow-up docker/buildx#3562

Adds scope input to create alternative Docker config on login that will be used by Buildx.

Example to scope auth token to specific repo:

  login:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v6
      -
        name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          username: ${{ vars.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
          scope: docker/buildx-bin

Docker config files on GitHub Runner:

## /home/runner/.docker/buildx/config/registry-1.docker.io/docker/buildx-bin/config.json
{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "REDACTED"
    }
  }
}

## /home/runner/.docker/config.json
{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "REDACTED"
    }
  }
}

/home/runner/.docker/config.json is the default one available on the runner.

Other example with scope auth token to specific repo and only push:

  login:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v6
      -
        name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          username: ${{ vars.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
          scope: docker/buildx-bin@push

Docker config files on GitHub Runner:

## /home/runner/.docker/buildx/config/registry-1.docker.io/docker/buildx-bin@push/config.json
{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "REDACTED"
    }
  }
}

## /home/runner/.docker/config.json
{
  "auths": {
    "https://index.docker.io/v1/": {
      "auth": "REDACTED"
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants