33* [ Cannot push to a registry] ( #cannot-push-to-a-registry )
44 * [ BuildKit container logs] ( #buildkit-container-logs )
55 * [ With containerd] ( #with-containerd )
6+ * [ ` repository name must be lowercase ` ] ( #repository-name-must-be-lowercase )
67
78## Cannot push to a registry
89
@@ -14,9 +15,11 @@ While pushing to a registry, you may encounter these kinds of issues:
1415* ` failed commit on ref "manifest-sha256:...": unexpected status: 401 Unauthorized `
1516* ` unexpected response: 401 Unauthorized `
1617
17- These issues are not directly related to this action but are rather linked to [ buildx] ( https://github.com/docker/buildx ) ,
18- [ buildkit] ( https://github.com/moby/buildkit ) , [ containerd] ( https://github.com/containerd/containerd ) or the registry
19- on which you're pushing your image. The quality of error message depends on the registry and are usually not very informative.
18+ These issues are not directly related to this action but are rather linked to
19+ [ buildx] ( https://github.com/docker/buildx ) , [ buildkit] ( https://github.com/moby/buildkit ) ,
20+ [ containerd] ( https://github.com/containerd/containerd ) or the registry on which
21+ you're pushing your image. The quality of error message depends on the registry
22+ and are usually not very informative.
2023
2124### BuildKit container logs
2225
@@ -25,8 +28,9 @@ action step and attach BuildKit container logs to your issue.
2528
2629### With containerd
2730
28- Next you can test pushing with [ containerd action] ( https://github.com/crazy-max/ghaction-setup-containerd ) using the
29- following workflow. If it works then open an issue on [ buildkit] ( https://github.com/moby/buildkit ) repository.
31+ Next you can test pushing with [ containerd action] ( https://github.com/crazy-max/ghaction-setup-containerd )
32+ using the following workflow. If it works then open an issue on [ buildkit] ( https://github.com/moby/buildkit )
33+ repository.
3034
3135``` yaml
3236name : containerd
6973 run : |
7074 sudo ctr --debug i push --user "${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}" docker.io/user/app:latest
7175` ` `
76+
77+ ## ` invalid reference format`
78+
79+ You may encounter this issue if you're using `github.repository` in your tag
80+ name :
81+
82+ ` ` `
83+ #10 importing cache manifest from ghcr.io/My-Org/repo:main
84+ #10 ERROR: invalid reference format: repository name must be lowercase
85+ ` ` `
86+
87+ # # `repository name must be lowercase`
88+
89+ You may encounter this issue if you're using `github.repository` as a repo slug
90+ in your tag :
91+
92+ ` ` `
93+ #6 exporting to image
94+ #6 exporting layers
95+ #6 exporting layers 1.2s done
96+ #6 exporting manifest sha256:b47f7dfb97b89ccd5de553af3c8cd94c4795884cbe5693e93946b1d95a7b1d12 0.0s done
97+ #6 exporting config sha256:995e93fab8196893192f08a38deea6769dc4d98f86cf705eccc24ec96a3e271c 0.0s done
98+ #6 ERROR: invalid reference format: repository name must be lowercase
99+ ------
100+ > exporting to image:
101+ ------
102+ error: failed to solve: invalid reference format: repository name must be lowercase
103+ ` ` `
104+
105+ or a cache reference :
106+
107+ ` ` `
108+ #10 importing cache manifest from ghcr.io/My-Org/repo:main
109+ #10 ERROR: invalid reference format: repository name must be lowercase
110+ ` ` `
111+
112+ To fix this issue you can use our [metadata action](https://github.com/docker/metadata-action)
113+ to generate sanitized tags, or a dedicated step to sanitize the slug :
114+
115+ ` ` ` yaml
116+ - name: Sanitize repo slug
117+ uses: actions/github-script@v4
118+ id: repo_slug
119+ with:
120+ result-encoding: string
121+ script: return ` ghcr.io/${github.repository.toLowerCase()}`
122+
123+ - name : Build and push
124+ uses : docker/build-push-action@v2
125+ with :
126+ context : .
127+ push : true
128+ tags : ${{ steps.repo_slug.outputs.result }}:latest
129+ ` ` `
0 commit comments