Skip to content

Instantly share code, notes, and snippets.

@yokawasa
Last active October 27, 2025 17:07
Show Gist options
  • Save yokawasa/841b6db379aa68b2859846da84a9643c to your computer and use it in GitHub Desktop.
Save yokawasa/841b6db379aa68b2859846da84a9643c to your computer and use it in GitHub Desktop.

Revisions

  1. yokawasa revised this gist Jan 17, 2022. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions ghcr.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,9 @@ you can do seamless access to containers from Actions workflows via the `GITHUB_
    See [Upgrading a workflow that accesses ghcr.io](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) for more detail
    ## Associate a certain package to a repository
    - [Connecting a repository to a package](https://docs.github.com/en/packages/learn-github-packages/connecting-a-repository-to-a-package)
    ## REFERENCES
    - https://github.com/features/packages
  2. yokawasa revised this gist Dec 1, 2021. 1 changed file with 25 additions and 3 deletions.
    28 changes: 25 additions & 3 deletions ghcr.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # ghcr (GitHub Container Registry) quickstart

    ## Setup GHCR
    ## CLI

    To push container images to ghcr, you need peronal access token (PAT) - see [how to create PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)

    @@ -21,7 +21,29 @@ Login Succeeded
    docker tag mycontainer ghcr.io/yokawasa/myrepo/mycontainer:0.0.1
    docker push ghcr.io/yokawasa/myrepo/mycontainer:0.0.1
    ```
    4. inspect

    ```bash
    docker inspect ghcr.io/yokawasa/myrepo/mycontainer:0.0.1
    ```

    ## GitHub Actions

    you can do seamless access to containers from Actions workflows via the `GITHUB_TOKEN`

    > The Container registry supports the GITHUB_TOKEN for easy and secure authentication in your workflows. If your workflow is using a personal access token (PAT) to authenticate to ghcr.io, then we highly recommend you update your workflow to use the GITHUB_TOKEN.

    ```yaml
    - name: Log in to registry
    # This is where you will update the PAT to GITHUB_TOKEN
    run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
    ```
    See [Upgrading a workflow that accesses ghcr.io](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) for more detail
    REFERENCES
    - https://github.com/features/packages
    ## REFERENCES
    - https://github.com/features/packages
    - [Upgrading a workflow that accesses ghcr.io](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)
  3. yokawasa revised this gist Oct 3, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ghcr.md
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,8 @@

    ## Setup GHCR

    To push container images to ghcr, you need peronal access token (PAT) - see [how to create PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)

    1. Get PAT (personal access token)

    Personal Settings > Developer settings > [Personal access tokens](https://github.com/settings/tokens)
  4. yokawasa revised this gist Oct 3, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ghcr.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Tips on GHCR (GitHub Container Registry)
    # ghcr (GitHub Container Registry) quickstart

    ## Setup GHCR

  5. yokawasa renamed this gist Oct 3, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. yokawasa created this gist Oct 3, 2021.
    25 changes: 25 additions & 0 deletions ghcr-tips.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # Tips on GHCR (GitHub Container Registry)

    ## Setup GHCR

    1. Get PAT (personal access token)

    Personal Settings > Developer settings > [Personal access tokens](https://github.com/settings/tokens)

    2. ghcr login test
    ```bash
    # echo $PAT | docker login ghcr.io -u <githubユーザ名> --password-stdin
    echo $PAT | docker login ghcr.io -u yokawasa --password-stdin

    Login Succeeded
    ```

    3. push
    ```bash
    docker tag mycontainer ghcr.io/yokawasa/myrepo/mycontainer:0.0.1
    docker push ghcr.io/yokawasa/myrepo/mycontainer:0.0.1
    ```


    REFERENCES
    - https://github.com/features/packages