docker/login-action@v4
GitHub Action to login against a Docker registry
At a glance
- Latest major
v4- Repository
- docker/login-action
- Inputs
- 7 (0 required)
- Outputs
- 0
- Runs using
node24- License
- Apache-2.0
- Last checked
Inputs and outputs come straight from the action's official action.yml. See our editorial standards.
Usage
- uses: docker/login-action@v4Inputs
| Name | Required | Default | Description |
|---|---|---|---|
registry | No | none | Server address of Docker registry. If not set then will default to Docker Hub |
username | No | none | Username used to log against the Docker registry |
password | No | none | Password or personal access token used to log against the Docker registry |
ecr | No | none | Specifies whether the given registry is ECR (auto, true or false) |
scope | No | none | Scope for the authentication token |
logout | No | true | Log out from the Docker registry at the end of a job |
registry-auth | No | none | Raw authentication to registries, defined as YAML objects |
Outputs
This action declares no outputs in its action.yml.
Examples
Log in to GitHub Container Registry
Use the built-in token, so there is no secret to create.
name: Example
on:
push:
branches: [main]
permissions:
contents: read
packages: write
jobs:
example:
runs-on: ubuntu-latest
steps:
- name: Docker Login
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}Log in to Docker Hub
Use an access token stored as a repository secret, not your account password.
name: Example
on:
push:
branches: [main]
permissions:
contents: read
jobs:
example:
runs-on: ubuntu-latest
steps:
- name: Docker Login
uses: docker/login-action@v4
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}Each example passed actionlint (syntax, expressions and the inputs it knows for this action). They were not run in a live repository, so replace placeholder values such as names, ARNs and paths with your own.
Something out of date or wrong? Report it on our Contact page. This page is rebuilt from the action's repository roughly once a week.