Search code examples
dockeractiongitea

gitea action build and push docker image results in failed to push with 404 error


I've created a gitea action to build and push a docker image to the docker registry hosted in gitea. When pushing the image, the task returns the follwing error:

ERROR: failed to solve: failed to push my.domain.com/ebooks:ae374c5d690cd6b29b4c91752e7998ed6539365a: unexpected status from POST request to https://my.domain.com/v2/ebooks/blobs/uploads/: 404 Not Found ::error::buildx failed with: ERROR: failed to solve: failed to push my.domain.com/ebooks:ae374c5d690cd6b29b4c91752e7998ed6539365a: unexpected status from POST request to https://my.domain.com/v2/ebooks/blobs/uploads/: 404 Not Found

This is the build task:

name: build
run-name: build
on: [push]

jobs:
  build:
    runs-on: default
    steps:
      - uses: actions/checkout@v4
      - name: setup docker buildx
        uses: docker/setup-buildx-action@v3
      - name: login to container registry
        uses: docker/login-action@v2
        with:
          registry: my.domain.com
          username: ${{secrets.USER}}
          password: ${{secrets.TOKEN}}
      - name: build and push docker image
        uses: docker/build-push-action@v5
        with:
          context: .
          file: ./Dockerfile
          push: true
          tags: "my.domain.com/ebooks:${{gitea.sha}},my.domain.com/ebooks:latest"

I am irritated by the v2 in the url of the error message. Could it be, that I'm using the wrong build action (docker/build-push-action@v5)? If so, what would be the correct one?

The steps before (docker login) are working correct.


Solution

  • found the solution by myself. Gitea needs the organisation in the tagname. So instead of the tagging: "my.domain.com/ebooks:${{gitea.sha}}"

    it also needed to use the organization: "my.domain.com/organisation/ebooks:${{gitea.sha}}"