1
0
Files
build-push-action/TROUBLESHOOTING.md
T

84 lines
2.7 KiB
Markdown
Raw Permalink Normal View History

2020-09-21 21:06:04 +02:00
# Troubleshooting
2020-10-23 22:51:59 +02:00
* [Cannot push to a registry](#cannot-push-to-a-registry)
2021-08-05 08:09:50 +02:00
* [`repository name must be lowercase`](#repository-name-must-be-lowercase)
2020-10-23 22:51:59 +02:00
## Cannot push to a registry
2020-09-21 21:06:04 +02:00
While pushing to a registry, you may encounter these kinds of issues:
* `failed commit on ref "layer-sha256:...": invalid content digest in response: invalid checksum digest format`
* `failed commit on ref "layer-sha256:...": no response`
2020-10-08 20:37:39 +02:00
* `failed commit on ref "manifest-sha256:...": unexpected status: 400 Bad Request`
2020-09-21 21:06:04 +02:00
* `failed commit on ref "manifest-sha256:...": unexpected status: 401 Unauthorized`
* `unexpected response: 401 Unauthorized`
2021-08-05 08:09:50 +02:00
These issues are not directly related to this action but are rather linked to
2022-10-07 19:16:42 +02:00
[Buildx](https://github.com/docker/buildx), [BuildKit](https://github.com/moby/buildkit),
2021-08-05 08:09:50 +02:00
[containerd](https://github.com/containerd/containerd) or the registry on which
you're pushing your image. The quality of error message depends on the registry
and are usually not very informative.
2020-09-21 21:06:04 +02:00
2021-04-23 23:34:43 +02:00
To help you solve this, you have to [enable debugging in the setup-buildx](https://github.com/docker/setup-buildx-action#buildkit-container-logs)
action step and attach BuildKit container logs to your issue.
2020-09-21 21:06:04 +02:00
2021-08-05 08:09:50 +02:00
## `repository name must be lowercase`
You may encounter this issue if you're using `github.repository` as a repo slug
in your tag:
```
#6 exporting to image
#6 exporting layers
#6 exporting layers 1.2s done
#6 exporting manifest sha256:b47f7dfb97b89ccd5de553af3c8cd94c4795884cbe5693e93946b1d95a7b1d12 0.0s done
#6 exporting config sha256:995e93fab8196893192f08a38deea6769dc4d98f86cf705eccc24ec96a3e271c 0.0s done
#6 ERROR: invalid reference format: repository name must be lowercase
------
> exporting to image:
------
error: failed to solve: invalid reference format: repository name must be lowercase
```
or a cache reference:
```
#10 importing cache manifest from ghcr.io/My-Org/repo:main
#10 ERROR: invalid reference format: repository name must be lowercase
```
To fix this issue you can use our [metadata action](https://github.com/docker/metadata-action)
to generate sanitized tags:
```yaml
- name: Docker meta
id: meta
2026-03-05 22:21:36 +01:00
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
tags: latest
- name: Build and push
2026-03-05 22:21:36 +01:00
uses: docker/build-push-action@v7
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
```
Or a dedicated step to sanitize the slug:
2021-08-05 08:09:50 +02:00
```yaml
- name: Sanitize repo slug
2026-03-05 22:21:36 +01:00
uses: actions/github-script@v8
2021-08-05 08:09:50 +02:00
id: repo_slug
with:
result-encoding: string
script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()
2021-08-05 08:09:50 +02:00
- name: Build and push
2026-03-05 22:21:36 +01:00
uses: docker/build-push-action@v7
2021-08-05 08:09:50 +02:00
with:
push: true
tags: ${{ steps.repo_slug.outputs.result }}:latest
```