From 575f8dcda1ba4abc187a476a5270ef14541c0715 Mon Sep 17 00:00:00 2001 From: taylanbakircioglu Date: Tue, 2 Jun 2026 15:07:05 +0300 Subject: [PATCH] ci: retry Docker Hub login to tolerate transient docker.io timeouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One matrix job intermittently failed at the login step with 'Get "https://registry-1.docker.io/v2/": context deadline exceeded' while sibling jobs authenticated fine with the same secrets — a transient network blip, not a credentials problem. Replace docker/login-action with a `docker login --password-stdin` retry loop (5 attempts, 10s backoff) so transient failures self-heal. --- .github/workflows/docker-build.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 3b54106..6dfa64b 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -51,10 +51,24 @@ jobs: run: echo "TAG=$(date +'%Y%m%d.%H%M')-${GITHUB_SHA::7}" >> $GITHUB_OUTPUT - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + run: | + # Retry to tolerate transient docker.io timeouts, e.g. + # 'Get "https://registry-1.docker.io/v2/": context deadline exceeded'. + # Credentials are written to ~/.docker/config.json, which buildx + # (docker/build-push-action) reads for the push. + for attempt in 1 2 3 4 5; do + if echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin; then + echo "Logged in to Docker Hub on attempt $attempt" + exit 0 + fi + echo "Docker Hub login attempt $attempt failed; retrying in 10s..." + sleep 10 + done + echo "::error::Docker Hub login failed after 5 attempts" + exit 1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3