To authenticate to the Github Container Registry, follow these steps:
- Generate a Personal Access Token: Navigate to the New personal access token (classic) page on GitHub and create a new token with the
write:packages
anddelete:packages
scopes. - Configure Your Environment: Save your personal access token and GitHub username as environment variables:
export GITHUB_TOKEN=<YOUR_TOKEN> export GITHUB_USERNAME=<YOUR_TOKEN>
- Log in to the Container Registry: Use the Docker CLI to log in to the GitHub Container Registry by piping your GitHub token as the password:
echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin