Skip to content

Instantly share code, notes, and snippets.

@magnetikonline
Last active December 10, 2023 10:53

Revisions

  1. magnetikonline revised this gist Dec 10, 2023. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -10,12 +10,12 @@ read:packages
    write:packages
    ```

    Make a note/store the token returned.
    Make a note of the access token returned.

    Next, use the access token with `docker login`, where `USERNAME` is your GitHub username:
    Next, use access token with `docker login`, where `USERNAME` is your GitHub username:

    ```sh
    $ echo "YOUR_TOKEN" | docker login ghcr.io -u USERNAME --password-stdin
    $ echo "ACCESS_TOKEN" | docker login ghcr.io -u USERNAME --password-stdin
    ```

    To push an image, where `OWNER` is your username/organisation name:
    @@ -39,4 +39,4 @@ Where a Container registry package has been shared to a GitHub repository, execu
    ## Reference
    - https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
    - https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
    - https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token
  2. magnetikonline revised this gist May 28, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ Where a Container registry package has been shared to a GitHub repository, execu
    - name: Login to Container registry
    run: |
    echo "${{ secrets.GITHUB_TOKEN }}" | \
    docker login ghcr.io -u ${{ github.actor }} --password-stdin
    docker login ghcr.io -u "${{ github.actor }}" --password-stdin
    ```
    ## Reference
  3. magnetikonline revised this gist May 28, 2021. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    # Quick example for using the GitHub Container registry

    ## Human user access

    Create a new [Personal access token](https://github.com/settings/tokens) with the following permissions:

    ```
    @@ -23,6 +25,18 @@ $ docker tag IMAGE_NAME:TAG_NAME ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
    $ docker push ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
    ```

    ## `docker login` within a GitHub Actions workflow

    Where a Container registry package has been shared to a GitHub repository, executred workflows within this repository now automatically gain access. From within a workflow run step:

    ```yaml
    - name: Login to Container registry
    run: |
    echo "${{ secrets.GITHUB_TOKEN }}" | \
    docker login ghcr.io -u ${{ github.actor }} --password-stdin
    ```
    ## Reference
    - https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
    - https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
  4. magnetikonline revised this gist May 26, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ $ echo "YOUR_TOKEN" | docker login ghcr.io -u USERNAME --password-stdin

    To push an image, where `OWNER` is your username/organisation name:

    ```
    ```sh
    $ docker tag IMAGE_NAME:TAG_NAME ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
    $ docker push ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
    ```
  5. magnetikonline created this gist May 26, 2021.
    28 changes: 28 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    # Quick example for using the GitHub Container registry

    Create a new [Personal access token](https://github.com/settings/tokens) with the following permissions:

    ```
    delete:packages
    read:packages
    write:packages
    ```

    Make a note/store the token returned.

    Next, use the access token with `docker login`, where `USERNAME` is your GitHub username:

    ```sh
    $ echo "YOUR_TOKEN" | docker login ghcr.io -u USERNAME --password-stdin
    ```

    To push an image, where `OWNER` is your username/organisation name:

    ```
    $ docker tag IMAGE_NAME:TAG_NAME ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
    $ docker push ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
    ```

    ## Reference

    - https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry