Publish docker package fails

I am attempting to build and push an image using buildx.

docker buildx build \
--platform linux/amd64,linux/arm/v7 \
--output "type=image,push=true" \
--tag $IMAGE_ID:$VERSION \
--file Dockerfile .

 The image appears to build fine but then I get this:

#42 ERROR: failed commit on ref "layer-sha256:841c5dec2f918bb9cfb333e0ffaf1aee4ce2b2d6f8b8dba0dccb9a7059ff23de": invalid content digest in response: invalid checksum digest format

I can build and push a standard image with no issues.

I do see what appears to be a failed attempt to publish a package but I have no way of deleting it.

Hi @mcaulifn .

Glad to see you in Github Community Forum! Could you please share more details of your yaml file? An example repo which can repo the error would be quite helpful.

Here is an sample which also used buildx. Regarding the package deletion, only the user with admin permissions to a repository can delete a version of a private package in that repository. Please check official doc here for more details.

Thanks.

Here is the YAML file that I was using.

name: buildx
on:
  push:
    branches:
      - master
    tags:
      - v*
env:
  IMAGE_NAME: MYIMAGE
jobs:
  buildx:
    runs-on: ubuntu-latest
    name: Build containers
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - uses: fusion-engineering/setup-git-credentials@v2
        with:
          credentials: '${{secrets.GIT_CREDENTIALS}}'
      - name: Set up Docker Buildx
        id: buildx
        uses: crazy-max/ghaction-docker-buildx@v1
        with:
          version: latest
      - name: Available platforms
        run: 'echo ${{ steps.buildx.outputs.platforms }}'
      - name: Log into registry
        run: >-
          echo "${{ secrets.GITHUB_TOKEN }}" | docker login
          docker.pkg.github.com -u ${{ github.actor }} --password-stdin
      - name: Run Buildx
        run: >
          cp $HOME/.config/git/credentials .

          IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME

          VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')

          [["${{ github.ref }}" == "refs/tags/"*]] && VERSION=$(echo $VERSION
          | sed -e 's/^v//')

          ["$VERSION" == "master"] && VERSION=latest

          echo IMAGE_ID=$IMAGE_ID

          echo VERSION=$VERSION

          docker buildx build \
            --platform linux/amd64,linux/arm/v7 \
            --output "type=image,push=true" \
            --tag $IMAGE_ID:$VERSION \
            --file Dockerfile .

I opened a ticket with GH support and deleting Docker images is not yet supported.

Hi @mcaulifn ,

I copied your yaml file and cannot repro the same error, could you please share a repo sample?

And there was a transient problem with uploading packages last week, please also retry the workflow run.

Thanks.

It is a private repo so I can’t share a link. What files did you need?

I found this similar issue: https://stackoverflow.com/questions/58977950/helm3-invalid-checksum-digest-format-while-pushing-chart-to-gitlab

I did re-run again and it is still failing with the same message.

Same error here.

I can’t push an image build with buildx to docker.pkg.githjub.com

1 Like

The only references to this error message online seem to involve docker buildx, the crazy-max/ghaction-docker-buildx action, and pushing to the GitHub Docker registry. Is GitHub using custom registry software? If so, is this potentially a bug in that software?

See: https://github.community/t5/GitHub-API-Development-and/Handle-multi-arch-Docker-images-on-GitHub-Package-Registry/m-p/31650#M2981

The GitHub Docker registry does not support multi-platform images.

Apparently multi-platform images are now deployed, but I’m getting the same error in the OP. Was that meant to fix the problem?

The Docker service docker.pkg.github.com has not (and will not) receive this update. The new Container Registry (GHCR) now supports multi-arch images.

I’ve updated the YAML above to (what I believe) fixes this problem. You’ll need to add the GHCR_PAT to your secrets because GHCR doesn’t support the GITHUB_TOKEN yet.

name: buildx
on:
  push:
    branches:
      - master
    tags:
      - v*
env:
  IMAGE_NAME: MYIMAGE
jobs:
  buildx:
    runs-on: ubuntu-latest
    name: Build containers
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - uses: fusion-engineering/setup-git-credentials@v2
        with:
          credentials: '${{secrets.GIT_CREDENTIALS}}'
      - name: Set up Docker Buildx
        id: buildx
        uses: crazy-max/ghaction-docker-buildx@v1
        with:
          version: latest
      - name: Available platforms
        run: 'echo ${{ steps.buildx.outputs.platforms }}'
      - name: Log into registry
        run: >-
          echo "${{ secrets.GHCR_PAT }}" | docker login
          ghcr.io -u ${{ github.actor }} --password-stdin
      - name: Run Buildx
        run: >
          cp $HOME/.config/git/credentials .

          IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME

          VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')

          [["${{ github.ref }}" == "refs/tags/"*]] && VERSION=$(echo $VERSION
          | sed -e 's/^v//')

          ["$VERSION" == "master"] && VERSION=latest

          echo IMAGE_ID=$IMAGE_ID

          echo VERSION=$VERSION

          docker buildx build \
            --platform linux/amd64,linux/arm/v7 \
            --output "type=image,push=true" \
            --tag $IMAGE_ID:$VERSION \
            --file Dockerfile .

Here’s an example of how we’re using it https://github.com/president-business-corp/multi-arch-test/blob/c0fac0e3b4fe947874d6e042da9f25226ed16d03/.github/workflows/buildx.yml

1 Like