1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/content/packages/guides/migrating-to-github-container-registry-for-docker-images.md
Melanie Yarbrough 91d3857341 [DO NOT MERGE] Universe 2020 Day 1: December 8, 2020 (#16480)
* Update README

* [Universe] Dark mode (#16545)

* Dark mode updates (#16696)

* [Universe] Corporate sponsors (#16457)

* Dependency review beta (#16563)

* Add placeholder topic file

* Revert change I didn't make

I'm not sure where this change came from or why it's showing up in my PR here but I didn't make this change and it's not part of Dependency Review so I'm reverting it.

* Un-revert previous change

OK I see what happened there. I was comparing the PR to main rather than the Universe megabranch, hence it showed a change I didn't make.
This commit undoes the change I do not want to revert on the megabranch.

* Update image to add the Checks tab

* Finish updating topic to mention DR

* Fix check errors

* Fix another versioning error

* Add a sentence about supported ecosystems

* Add review changes

* Remove Further reading topics in same category

As suggested by James, I've removed the links to topics that are in the same `/collaborating-with-issues-and-pull-requests/` category as this topic.

* Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md

Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>

* Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md

Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>

* Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md

Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>

* Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md

* Updates in the light of Maya's review

* Remove use of "exploit" in description

* Change 'dependency review summary' to 'dependency review'

See PR review comment from Maya.

* Mention that the age of the dependency is given

* Update screenshots to latest GUI

* Add details of dependency ordering within a DR

* Update content/github/collaborating-with-issues-and-pull-requests/reviewing-dependency-changes-in-a-pull-request.md

Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>

* Update content/github/managing-security-vulnerabilities/about-managing-vulnerable-dependencies.md

Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>

* Update content/github/visualizing-repository-data-with-graphs/about-the-dependency-graph.md

Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>

Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>

* [Universe 2020] New audit log REST API endpoint (#16699)

* Minimal updates for preview

*  API previews 

* Update beta note

*  Update API previews 

*  Update previews 

* Add draft section for git events

* Clean API previews

* More fixes + API previews

* Address review comments + update API previews

* Mention cursor-based pagination

* Update content/rest/overview/resources-in-the-rest-api.md

Co-authored-by: Jeff Saracco <jeffsaracco@github.com>

* Temporarily revert API previews

* Small tweaks from review comments + API previews

* revert json schemas

* Updating OpenAPI descriptions (#16776)

* Updating OpenAPI descriptions

* Add decorated OpenAPI schema files

Co-authored-by: Jeff Saracco <jeffsaracco@github.com>
Co-authored-by: skedwards88 <skedwards88@github.com>
Co-authored-by: github-openapi-bot <69533958+github-openapi-bot@users.noreply.github.com>

* [Universe 2020] GitHub Actions: Workflow visualization (#16629)

* initial empty commit

* replace image used only for dotcom

* add new image and version usage

* add new image and version usage

* add new image and version usage

* add new image and version usage, delete unneeded image

* add new image and version usage, fix incorrect image

* add new image and version usage

* add new image and version usage

* add new image and version usage

* add new image and version usage

* update screenshot update

* add new image and version usage

* add new image and version usage

* update text

* update images and fix list numbering

* add step with graph

* Add missing versioning

* add overview of visualization

* fix title to match filename

* add beta note

* update wording

* Restructuring packages (#16731)

* restructuring packages

* moving more content

* moving more content

* fixing the toc for guides

* removing CR from the landing page

* adjusting qs

* updating npm

* enhancing guides

* Update updating-github-insights.md

* fixing link problems

* fixing link problems

* redirecting the redirects

* another change

* fixing the guides landing page

* add packages quickstart

* moving CR content

* adding some descriptive text

* add packages landing page

* adding guide content back

* update popular articles based on data

* fix caps on product name

* try removing product from front matter

* Update content/packages/quickstart.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* Update content/packages/quickstart.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* add node package instructions to quickstart

* fixing links and adding redirect

* fixing redirects

* renaming to container guides

* renaming to container guides and fixing reusables

* adding context and about section to CR

* removign landign page extra titles and descriptions

* reverting the packages

* updating link

* Apply suggestions from code review

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* updating

* update test to reflect redesigned product landing page

* Add private vs public clarification

* Fix borked test

* filter out standalone category files from test

Co-authored-by: Cynthia Rich <crichID@github.com>
Co-authored-by: Cynthia Rich <crichID@users.noreply.github.com>
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
Co-authored-by: Sarah Schneider <sarahs@github.com>
Co-authored-by: Jason Etcovitch <jasonetco@github.com>

* Add discussions video
See https://github.com/github/docs-internal/pull/16759

* Remove typos

* update article name in test

Co-authored-by: Laura Coursen <lecoursen@github.com>
Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com>
Co-authored-by: hubwriter <hubwriter@github.com>
Co-authored-by: James Fletcher <42464962+jf205@users.noreply.github.com>
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
Co-authored-by: Jeff Saracco <jeffsaracco@github.com>
Co-authored-by: skedwards88 <skedwards88@github.com>
Co-authored-by: github-openapi-bot <69533958+github-openapi-bot@users.noreply.github.com>
Co-authored-by: Meg Bird <megbird@github.com>
Co-authored-by: Leona B. Campbell <3880403+runleonarun@users.noreply.github.com>
Co-authored-by: Cynthia Rich <crichID@github.com>
Co-authored-by: Cynthia Rich <crichID@users.noreply.github.com>
Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
Co-authored-by: Sarah Schneider <sarahs@github.com>
Co-authored-by: Jason Etcovitch <jasonetco@github.com>
2020-12-08 12:20:02 -05:00

7.3 KiB

title, intro, product, redirect_from, versions
title intro product redirect_from versions
Migrating to GitHub Container Registry for Docker images If you've used the GitHub Packages Docker registry to store Docker images, you can migrate to the new {% data variables.product.prodname_container_registry %}. {% data reusables.gated-features.packages %}
/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images
free-pro-team
*

Key differences between {% data variables.product.prodname_github_container_registry %} and the Docker package registry

{% data reusables.package_registry.container-registry-beta %}

The {% data variables.product.prodname_github_container_registry %} supersedes the existing Packages Docker registry and is optimized to support some of the unique needs of containers.

{% data reusables.package_registry.container-registry-feature-highlights %}

For more information, see "About {% data variables.product.prodname_github_container_registry %}."

Billing changes

{% data reusables.package_registry.billing-for-container-registry %}

Domain changes

The domain for the {% data variables.product.prodname_container_registry %} is ghcr.io.

Registry Example URL
{% data variables.product.prodname_registry %} Docker registry docker.pkg.github.com/OWNER/REPOSITORY/IMAGE_NAME
{% data variables.product.prodname_github_container_registry %} ghcr.io/OWNER/IMAGE_NAME

Authenticating with the container registry

{% data reusables.package_registry.feature-preview-for-container-registry %}

You will need to authenticate to the {% data variables.product.prodname_container_registry %} with the base URL ghcr.io. We recommend creating a new access token for using the {% data variables.product.prodname_container_registry %}.

{% data reusables.package_registry.authenticate_with_pat_for_container_registry %}

{% data reusables.package_registry.authenticate-to-container-registry-steps %}

Migrating a Docker image using the Docker CLI

To move Docker images that you host on {% data variables.product.prodname_registry %} Docker registry, you must republish the images to {% data variables.product.prodname_container_registry %}. We recommend republishing your existing Docker images using the command line on your local machine.

  1. Sign in to the Docker registry using a temporary PAT with at least the read:packages scope. This PAT will only be used to sign in to the Docker registry to pull down images and can be deleted afterward. {% raw %}
$ echo $READ_PACKAGES_TOKEN | docker login docker.pkg.github.com -u USERNAME --password-stdin

{% endraw %} 2. Pull down the image you'd like to migrate, replacing OWNER with the name of the user or organization account that owns the repository, REPOSITORY with the name of the repository containing your project, IMAGE_NAME with name of the package or image, VERSION with tag for the image you want to install. For example, docker pull docker.pkg.github.com/octo-org/octoshift/octoshift:latest pulls the latest tag of the octoshift/octoshift image in the octo-org organization.

$ docker pull docker.pkg.github.com/OWNER/REPOSITORY/IMAGE_NAME:VERSION
  1. Re-tag the image with the new domain and a new image name. For more information, see "Docker tag" in the Docker documentation. Use the same URL that you used in the previous step for the SOURCE URL. Replace the TARGET_OWNER with the user or organization that you are migrating the container image to and replace the TARGET_IMAGE_NAME with the new {% data variables.product.prodname_container_registry %} image name.
$ docker tag docker.pkg.github.com/SOURCE_OWNER/SOURCE_REPOSITORY/SOURCE_IMAGE_NAME:VERSION ghcr.io/TARGET_OWNER/TARGET_IMAGE_NAME:VERSION
  1. Sign in to the new {% data variables.product.prodname_container_registry %}. We recommend creating a new PAT limited to the read:packages and write:packages scopes since you no longer need the repo scope and your previous PAT may not have the write:packages scope. {% raw %}
$ echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin

{% endraw %} 5. Push your re-tagged image to the {% data variables.product.prodname_container_registry %}.

$ docker push ghcr.io/OWNER/IMAGE_NAME:VERSION

Updating your {% data variables.product.prodname_actions %} workflow

{% data reusables.package_registry.feature-preview-for-container-registry %}

If you have a {% data variables.product.prodname_actions %} workflow that uses a Docker image from the {% data variables.product.prodname_registry %} Docker registry, you may want to update your workflow to the {% data variables.product.prodname_container_registry %} to allow for anonymous access for public container images, finer-grain access permissions, and better storage and bandwidth compatibility for containers.

  1. Migrate your Docker images to the new {% data variables.product.prodname_container_registry %} at ghcr.io. For an example, see "Migrating a Docker image using the Docker CLI."

  2. In your {% data variables.product.prodname_actions %} workflow file, update the package url from https://docker.pkg.github.com to ghcr.io.

  3. Add your new {% data variables.product.prodname_container_registry %} authentication personal access token (PAT) as a GitHub Actions secret. {% data variables.product.prodname_github_container_registry %} does not support using GITHUB_TOKEN for your PAT so you must use a different custom variable, such as CR_PAT. For more information, see "Creating and storing encrypted secrets."

  4. In your {% data variables.product.prodname_actions %} workflow file, update the authentication PAT by replacing your Docker registry PAT ({% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}) with a new variable for your {% data variables.product.prodname_container_registry %} PAT, such as {% raw %}${{ secrets.CR_PAT }}{% endraw %}.

Example of updated workflow

If part of your workflow accessed a Docker image hosted by the Docker registry like this:

{% raw %}

echo ${{ secrets.GITHUB_TOKEN }} | docker login https://docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin
docker pull docker.pkg.github.com/github/octoshift/octoshift:latest
docker build . --tag docker.pkg.github.com/github/octoshift/octoshift:$GITHUB_SHA --cache-from docker.pkg.github.com/github/octoshift/octoshift:latest
docker push docker.pkg.github.com/github/octoshift/octoshift:$GITHUB_SHA

{% endraw %}

Then you'll need to update your workflow with the new {% data variables.product.prodname_container_registry %} URL and PAT like this:

{% raw %}

# new login with new container registry url and PAT
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
# new container registry urls added
docker pull ghcr.io/github/octoshift:latest
docker build . --tag ghcr.io/github/octoshift:$GITHUB_SHA --cache-from ghcr.io/github/octoshift:latest
docker push ghcr.io/github/octoshift:$GITHUB_SHA

{% endraw %}