无法将Docker镜像推送至GitHub Packages问题求助
Check Docker Image Tag Format
GitHub Packages requires Docker images to follow a specific naming convention to associate with your repository:
- For the modern GHCR registry:
ghcr.io/<owner>/<repo>/<image-name>:<tag> - For the legacy Docker registry:
docker.pkg.github.com/<owner>/<repo>/<image-name>:<tag>
If your image tag doesn’t include <owner>/<repo>, the package will not link to your project. Example valid tag for repo DJViking/hazelcast-project:
ghcr.io/DJViking/hazelcast-project/hazelcast:latest
Look in Personal/Organization Packages Tab
If you used an incorrect tag, the package might have been created under your personal GitHub account or organization instead of the specific repository.
- Go to your GitHub profile → Packages (or your organization’s Packages page) to check if the image exists there.
Link Existing Package to Your Repository
If you found the package in your personal/org Packages:
- Navigate to the package’s page.
- Go to Settings → Linked repositories.
- Click Add repository and select your target project repo. This will make the package appear in the repo’s Packages list.
Verify Workflow Permissions (For GitHub Actions)
Ensure your workflow has the required permissions to push packages:
Add this to your workflow YAML file:
permissions: packages: write
Also confirm the GITHUB_TOKEN used in the workflow has the packages:write scope (this is enabled by default for most repos, but double-check if you’ve modified permissions).
Validate Manual Push Command
Make sure your manual push uses the correct registry and tag:
- Log in to the registry:
docker login ghcr.io -u <your-username> -p <your-personal-access-token> - Build with the correct tag:
docker build -t ghcr.io/<owner>/<repo>/hazelcast:latest . - Push the image:
docker push ghcr.io/<owner>/<repo>/hazelcast:latest
Wait for UI Sync
GitHub’s UI can sometimes take 5-10 minutes to reflect newly pushed packages. Refresh the repo’s Packages page after waiting a few minutes.
内容的提问来源于stack exchange,提问作者DJViking

