Skip to content

ci instability: docker buildx build ... -f tests/bats/Dockerfile fails with "already exists" #908

@jgehrcke

Description

@jgehrcke
make -f tests/bats/Makefile tests
make[1]: Entering directory '/tmp/jp-gh-runner-jp-cd-runner-134/k8s-dra-driver-gpu/k8s-dra-driver-gpu'
docker buildx build . -t batstests:db70fc24 -f tests/bats/Dockerfile

...

#13 ERROR: image "docker.io/library/batstests:db70fc24": already exists
------
 > exporting to image:
------
ERROR: failed to build: failed to solve: image "docker.io/library/batstests:db70fc24": already exists
make[1]: *** [tests/bats/Makefile:141: runner-image] Error 1
make[1]: Leaving directory '/tmp/jp-gh-runner-jp-cd-runner-134/k8s-dra-driver-gpu/k8s-dra-driver-gpu'
make: *** [Makefile:226: bats] Error 2

https://github.com/NVIDIA/k8s-dra-driver-gpu/actions/runs/22676155766/job/65736033780#step:3:59

This is transient, a retry helps. Interesting.

Perplexity says:

This error occurs when docker buildx (via BuildKit) tries to export the final image into the local Docker image store and finds that a tag with that exact name already exists. Unlike the classic docker build, newer versions of BuildKit/BuildX refuse to overwrite an existing tag rather than silently replacing it.

Maybe, if this happens more often, even w/o understanding the exact mechanics we may want to skip the image build if the tag seems to exist locally:

    docker image inspect batstests:$(GIT_SHA) > /dev/null 2>&1 || \
        docker buildx build . -t batstests:$(GIT_SHA) -f tests/bats/Dockerfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    ci-instabilitynon-deterministic CI / build failure

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions