mirror of
https://github.com/docker/build-push-action
synced 2024-11-22 18:31:40 +00:00
Add Troubleshooting section
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
1f11648765
commit
5281740ad2
2 changed files with 356 additions and 291 deletions
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -3,6 +3,10 @@ name: Bug report
|
|||
about: Create a report to help us improve
|
||||
---
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
Before sumbitting a bug report please read the [Troubleshooting section](https://github.com/docker/build-push-action#troubleshooting) in the README.
|
||||
|
||||
### Behaviour
|
||||
|
||||
#### Steps to reproduce this issue
|
||||
|
|
139
README.md
139
README.md
|
@ -30,6 +30,7 @@ ___
|
|||
* [Customizing](#customizing)
|
||||
* [inputs](#inputs)
|
||||
* [outputs](#outputs)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
||||
* [Limitation](#limitation)
|
||||
|
||||
|
@ -44,10 +45,10 @@ build-secrets, remote cache, etc. and different builder deployment/namespacing o
|
|||
|
||||
The default behavior of this action is to use the [Git context invoked by your workflow](https://github.com/docker/build-push-action/blob/master/src/context.ts#L35).
|
||||
|
||||
> :warning: Subdir for this context is [not yet supported](https://github.com/docker/build-push-action/issues/120).
|
||||
> For the moment you can use the [path context](#path-context).
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
```yaml
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
|
@ -80,7 +81,8 @@ jobs:
|
|||
-
|
||||
name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
If you use this action in a private repository, you have to pass the [GitHub Token](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token)
|
||||
as a secret named `GIT_AUTH_TOKEN` to be able to authenticate against it with buildx:
|
||||
|
@ -97,18 +99,24 @@ as a secret named `GIT_AUTH_TOKEN` to be able to authenticate against it with bu
|
|||
GIT_AUTH_TOKEN=${{ github.token }}
|
||||
```
|
||||
|
||||
> :warning: Subdir for Git context is [not yet supported](https://github.com/docker/build-push-action/issues/120).
|
||||
> For the moment you can use the [path context](#path-context).
|
||||
|
||||
### Path context
|
||||
|
||||
You can also use the `PATH` context alongside the [`actions/checkout`](https://github.com/actions/checkout/) action.
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
on:
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
jobs:
|
||||
path-context:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -136,18 +144,22 @@ jobs:
|
|||
platforms: linux/amd64,linux/arm64,linux/386
|
||||
push: true
|
||||
tags: user/app:latest
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
### Isolated builders
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
on:
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
jobs:
|
||||
multi-builders:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -175,18 +187,22 @@ jobs:
|
|||
with:
|
||||
builder: ${{ steps.builder2.outputs.name }}
|
||||
target: mytarget2
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
### Multi-platform image
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
on:
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
jobs:
|
||||
multi:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -216,7 +232,8 @@ jobs:
|
|||
tags: |
|
||||
user/app:latest
|
||||
user/app:1.0.0
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
## Advanced usage
|
||||
|
||||
|
@ -224,14 +241,17 @@ jobs:
|
|||
|
||||
For testing purposes you may need to create a [local registry](https://hub.docker.com/_/registry) to push images into.
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
on:
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
jobs:
|
||||
local-registry:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
|
@ -258,21 +278,25 @@ jobs:
|
|||
name: Inspect
|
||||
run: |
|
||||
docker buildx imagetools inspect localhost:5000/name/app:latest
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
### Leverage GitHub cache
|
||||
|
||||
You can leverage [GitHub cache](https://docs.github.com/en/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)
|
||||
using [actions/cache](https://github.com/actions/cache) with this action.
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
on:
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
jobs:
|
||||
github-cache:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -301,7 +325,8 @@ jobs:
|
|||
tags: user/app:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
### Complete workflow
|
||||
|
||||
|
@ -322,10 +347,13 @@ might want to use:
|
|||
| `push` | `refs/heads/my/branch` | `a5df687` | `sha-a5df687`, `my-branch` | Yes |
|
||||
| `push tag` | `refs/tags/v1.2.3` | | `v1.2.3`, `v1.2`, `v1`, `latest` | Yes |
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
on:
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # everyday at 10am
|
||||
push:
|
||||
|
@ -335,7 +363,7 @@ on:
|
|||
- 'v*.*.*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -403,7 +431,8 @@ jobs:
|
|||
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
### Update DockerHub repo description
|
||||
|
||||
|
@ -411,14 +440,17 @@ You can update the [Docker Hub repository description](https://docs.docker.com/d
|
|||
a third-party action called [Docker Hub Description](https://github.com/peter-evans/dockerhub-description)
|
||||
with this action.
|
||||
|
||||
```yaml
|
||||
name: ci
|
||||
<details>
|
||||
<summary><b>Show workflow</b></summary>
|
||||
|
||||
on:
|
||||
```yaml
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
|
||||
jobs:
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
@ -447,7 +479,8 @@ jobs:
|
|||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
DOCKERHUB_REPOSITORY: user/app
|
||||
```
|
||||
```
|
||||
</details>
|
||||
|
||||
## Customizing
|
||||
|
||||
|
@ -503,6 +536,34 @@ Following outputs are available
|
|||
|---------------|---------|---------------------------------------|
|
||||
| `digest` | String | Image content-addressable identifier also called a digest |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
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`
|
||||
* `failed commit on ref "manifest-sha256:...": unexpected status: 401 Unauthorized`
|
||||
* `unexpected response: 401 Unauthorized`
|
||||
|
||||
These issues are not directly related to this action but are rather linked to [buildx](https://github.com/docker/buildx),
|
||||
[buildkit](https://github.com/moby/buildkit), [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.
|
||||
|
||||
To help you solve this, you should first enable debugging in the
|
||||
[setup-buildx action step](https://github.com/docker/setup-buildx-action):
|
||||
|
||||
```yaml
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
buildkitd-flags: --debug
|
||||
```
|
||||
|
||||
Next you can test pushing with containerd using [this workflow](https://github.com/crazy-max/ghaction-setup-containerd#build-and-push-docker-image).
|
||||
Do not forget to set `ctr --debug` for the pushing step. If it works then open an issue on
|
||||
[buildkit](https://github.com/moby/buildkit) repository.
|
||||
|
||||
## Keep up-to-date with GitHub Dependabot
|
||||
|
||||
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
|
||||
|
|
Loading…
Reference in a new issue