Skip to content

Commit e64ffa5

Browse files
authored
Add workflow info and links
1 parent 7bd553f commit e64ffa5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

content/packages/working-with-a-github-packages-registry/working-with-the-container-registry.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ This example pushes the `2.5` version of the image.
7575

7676
{% data reusables.package_registry.publishing-user-scoped-packages %} You can link a published package to a repository using the user interface or command line. For more information, see "[AUTOTITLE](/packages/learn-github-packages/connecting-a-repository-to-a-package)."
7777

78-
Also if you push a container image without the proper labels, GitHub will not connect the package to the repository. This results in the "[GITHUB_TOKEN](/actions/security-guides/automatic-token-authentication)" not having the appropriate permissions for this package.
78+
When you push a container image from the command line, the image is not linked to a repository by default. This is the case even if you tag the image with a namespace that matches the name of the repository, such as `{% ifversion fpt or ghec %}ghcr.io{% elsif ghes > 3.4 %}{% data reusables.package_registry.container-registry-example-hostname %}{% endif %}/octocat/my-repo:latest`.
7979

80-
See "[Connecting a repository to a package](/packages/learn-github-packages/connecting-a-repository-to-a-package)".
80+
The easiest way to connect a repository to a container package is to publish the package from a workflow using `${% raw %}{{secrets.GITHUB_TOKEN}}{% endraw %}`, as the repository that contains the workflow is linked automatically. Note that the `GITHUB_TOKEN` will not have permission to push the package if you have previously pushed a package to the same namespace, but have not connected the package to the repository.
81+
82+
To connect a repository when publishing an image from the command line, and to ensure your `GITHUB_TOKEN` has appropriate permissions when using a GitHub Actions workflow, we recommend adding the label `org.opencontainers.image.source` to your `Dockerfile`. For more information, see “[Labelling container images](#labelling-container-images)” in this article and “[AUTOTITLE](/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions).”
8183

8284
## Pulling container images
8385

0 commit comments

Comments
 (0)