3
0
Fork 0
mirror of https://gitea.com/docker/login-action.git synced 2024-11-22 09:29:36 +01:00

Add example for GitHub Container Registry

This commit is contained in:
CrazyMax 2020-09-01 20:38:53 +02:00
parent 6304aa16ae
commit 9c109c7824
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7

View file

@ -8,13 +8,19 @@
GitHub Action to login against a Docker registry. 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) ![Screenshot](.github/docker-login.png)
___ ___
* [Usage](#usage) * [Usage](#usage)
* [DockerHub](#dockerhub) * [DockerHub](#dockerhub)
* [GitHub Package Registry](#github-package-registry) * [GitHub Packages Docker Registry](#github-packages-docker-registry)
* [GitHub Container Registry](#github-container-registry)
* [GitLab](#gitlab) * [GitLab](#gitlab)
* [Azure Container Registry (ACR)](#azure-container-registry-acr) * [Azure Container Registry (ACR)](#azure-container-registry-acr)
* [Google Container Registry (GCR)](#google-container-registry-gcr) * [Google Container Registry (GCR)](#google-container-registry-gcr)
@ -39,9 +45,6 @@ jobs:
login: login:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
-
name: Checkout
uses: actions/checkout@v2
- -
name: Login to DockerHub name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v1
@ -50,7 +53,9 @@ jobs:
password: ${{ secrets.DOCKERHUB_PASSWORD }} 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 ```yaml
name: ci name: ci
@ -64,10 +69,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
name: Checkout name: Login to GitHub Packages Docker Registry
uses: actions/checkout@v2
-
name: Login to GitHub Package Registry
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: docker.pkg.github.com registry: docker.pkg.github.com
@ -75,6 +77,32 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} 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 ### GitLab
```yaml ```yaml
@ -88,9 +116,6 @@ jobs:
login: login:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
-
name: Checkout
uses: actions/checkout@v2
- -
name: Login to GitLab name: Login to GitLab
uses: docker/login-action@v1 uses: docker/login-action@v1
@ -117,9 +142,6 @@ jobs:
login: login:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
-
name: Checkout
uses: actions/checkout@v2
- -
name: Login to ACR name: Login to ACR
uses: docker/login-action@v1 uses: docker/login-action@v1
@ -149,9 +171,6 @@ jobs:
login: login:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
-
name: Checkout
uses: actions/checkout@v2
- -
name: Login to GCR name: Login to GCR
uses: docker/login-action@v1 uses: docker/login-action@v1
@ -178,9 +197,6 @@ jobs:
login: login:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
-
name: Checkout
uses: actions/checkout@v2
- -
name: Login to ECR name: Login to ECR
uses: docker/login-action@v1 uses: docker/login-action@v1