mirror of
https://github.com/docker/login-action
synced 2024-11-22 05:01:42 +00:00
Add example for GitHub Container Registry
This commit is contained in:
parent
6304aa16ae
commit
9c109c7824
1 changed files with 37 additions and 21 deletions
58
README.md
58
README.md
|
@ -8,13 +8,19 @@
|
|||
|
||||
GitHub Action to login against a Docker registry.
|
||||
|
||||
> :bulb: See also:
|
||||
> * [setup-buildx](https://github.com/docker/setup-buildx-action) action
|
||||
> * [setup-qemu](https://github.com/docker/setup-qemu-action) action
|
||||
> * [build-push](https://github.com/docker/build-push-action) action
|
||||
|
||||
![Screenshot](.github/docker-login.png)
|
||||
|
||||
___
|
||||
|
||||
* [Usage](#usage)
|
||||
* [DockerHub](#dockerhub)
|
||||
* [GitHub Package Registry](#github-package-registry)
|
||||
* [GitHub Packages Docker Registry](#github-packages-docker-registry)
|
||||
* [GitHub Container Registry](#github-container-registry)
|
||||
* [GitLab](#gitlab)
|
||||
* [Azure Container Registry (ACR)](#azure-container-registry-acr)
|
||||
* [Google Container Registry (GCR)](#google-container-registry-gcr)
|
||||
|
@ -39,9 +45,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
|
@ -50,7 +53,9 @@ jobs:
|
|||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
```
|
||||
|
||||
### GitHub Package Registry
|
||||
### GitHub Packages Docker Registry
|
||||
|
||||
You can configure the Docker client to use [GitHub Packages to publish and retrieve docker images](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages).
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
@ -64,10 +69,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to GitHub Package Registry
|
||||
name: Login to GitHub Packages Docker Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: docker.pkg.github.com
|
||||
|
@ -75,6 +77,32 @@ jobs:
|
|||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
```
|
||||
|
||||
### GitHub Container Registry
|
||||
|
||||
To authenticate against the [GitHub Container Registry](https://docs.github.com/en/packages/getting-started-with-github-container-registry),
|
||||
you will need to create a new [personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
|
||||
with the [appropriate scopes](https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry).
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
```
|
||||
|
||||
### GitLab
|
||||
|
||||
```yaml
|
||||
|
@ -88,9 +116,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to GitLab
|
||||
uses: docker/login-action@v1
|
||||
|
@ -117,9 +142,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to ACR
|
||||
uses: docker/login-action@v1
|
||||
|
@ -149,9 +171,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to GCR
|
||||
uses: docker/login-action@v1
|
||||
|
@ -178,9 +197,6 @@ jobs:
|
|||
login:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
-
|
||||
name: Login to ECR
|
||||
uses: docker/login-action@v1
|
||||
|
|
Loading…
Reference in a new issue