Skip to content

Track workflow-level retry support for transient registry login failures #750

Open

Description

@sophiewigmore

Hey! Occasionally, our login step fails due to rate-limiting or the system we're logging into being unavailable. It would be super useful to have a retry flag of some kind. Based on similar functionality for other actions in the space, imagining it might look like:

- name: Login
   uses: docker/login-action@v3
   with:
       registry: ...
       username: ...
       password: ...
       retries: 3

Activity

  1. ashwinkhode commented on Jul 18, 2024

    @ashwinkhode

    +1

  2. nephatrine commented on Aug 20, 2024

    @nephatrine

    This would be fantastic. I have actions occasionally fail with Client.Timeout exceeded while awaiting headers and just rerunning the step does the trick in those instances.

  3. szofar commented on Sep 11, 2024

    @szofar

    same! our Harbor registry times out ALL the time and I have to go manually re-trigger the workflow

  4. crazy-max commented on Oct 4, 2024

    @crazy-max
    Member

    our login step fails due to rate-limiting

    Hammering a registry of requests because it's unavailable is not a short or long term solution. Registries often implement rate limiting to prevent abuse and ensure fair usage among all users. If a login attempt fails due to rate limiting, retrying the login multiple times in quick succession can exacerbate the problem. This can lead to further rate limiting, potentially locking out the user for a longer period or affecting other users who are trying to access the registry. If the registry is temporarily unavailable due to maintenance or an outage, retrying the login multiple times will not resolve the issue. This can result in unnecessary load on the registry once it becomes available again, as multiple clients may attempt to reconnect simultaneously.

    While retry logic can be useful, it's important to implement it thoughtfully to avoid exacerbating issues like rate limiting and system unavailability. Using smth like exponential backoff, circuit breaker patterns could be a solution.

  5. ealogar commented on Oct 31, 2024

    @ealogar

    I would consider to add more status code for the retries as an optional property in the action.
    There are situations where a 401 is returned from a custom registry as a security mechanism to avoid giving hints and you may want to retry those as well (of course with a backoff retry policy in place...). Maybe not the default but overridable would be great

  6. fedordikarev commented on Jan 24, 2025

    @fedordikarev

    hi!
    here is my second approach to that issue with more dedicated time rather than 30 minutes in the train I had for the first attempt :)

    @crazy-max can you take a look #849 and let me know what you think about that approach?

  7. mikebowyer commented on Apr 17, 2025

    @mikebowyer

    @crazy-max, this would be very beneficial to have. Is there anything we can help do to the PR from @fedordikarev merged?

  8. sgutwein commented on Sep 11, 2025

    @sgutwein

    Please add the retry! It's so annoying when you having a con job, triggered at night, failing because of this!

  9. 2ooLe commented on Sep 17, 2025

    @2ooLe

    @crazy-max Could we get some eyes on: #849 please?

  10. sebwalle commented on Dec 1, 2025

    @sebwalle

    we need this too. Please fix

  11. fedordikarev commented on Dec 2, 2025

    @fedordikarev

    hey @crazy-max , beside of that topic being hot, I also understand that I am not the best actions developer in the world, and my PR may be not in the direction you'd like it to be.
    Being your sponsor here on GitHub for a past few months, and on that sponsorship level may I use your statement:

    You're very supportive 🙌 Is there a project you want me to focus on?

    and can you give some hint on what to improve on my approach to be accepted?

  12. crazy-max commented on Apr 2, 2026

    @crazy-max
    Member

    This looks like the same class of problem as the retry requests already discussed across sibling actions, for example:

    I don't think action-specific retry logic is the right direction for login-action.

    This is not really a login feature, it's a generic workflow reliability problem. The same class of transient failures shows up across login, bootstrap, pulls, cache operations, auth, and pushes, depending on the runner, registry, and network path involved. Adding retry logic independently in each action means each action has to guess which errors are safe to retry across different registries and failure modes, which gets brittle quickly.

    It's also the wrong abstraction layer. This kind of behavior belongs in GitHub runner or workflow primitives, for example first-class retry support for uses: steps, rather than each action inventing its own retry semantics. That would be reusable across actions, more consistent for users, and more future proof.

    For auth failures specifically, action-local retries are not obviously correct. A 401, timeout, or rate limit can imply very different causes, and retrying inside the action can hide real configuration problems or add more pressure to the registry.

    So I'd rather keep this tracked here as part of the broader retry discussion than add retry or backoff logic directly to this action.

  13. changed the title [-]Add retry[/-] [+]Track workflow-level retry support for transient registry login failures[/+] on Apr 2, 2026
  14. jprecuch commented on May 13, 2026

    @jprecuch

    We also can see that first "internal job" of GitHub does retries when starting containers and it resolves the flakiness there long-term

    Checking docker version
    Clean up resources from previous jobs
    Create local container network
    Starting job container
      /usr/bin/docker --config /data/ephemeral/ephemeral-runner-2hwuu/_work-quizzical_chaplygin/_temp/.docker_1646d4d5-b1cd-4b2e-8325-9dca446f5a8b login ghcr.io -u xxx --password-stdin
      Warning: Docker login for 'ghcr.io' failed with exit code 1, back off 8.26 seconds before retry.
      /usr/bin/docker --config /data/ephemeral/ephemeral-runner-2hwuu/_work-quizzical_chaplygin/_temp/.docker_1646d4d5-b1cd-4b2e-8325-9dca446f5a8b login ghcr.io -u xxx --password-stdin
      /usr/bin/docker --config /data/ephemeral/ephemeral-runner-2hwuu/_work-quizzical_chaplygin/_temp/.docker_1646d4d5-b1cd-4b2e-8325-9dca446f5a8b pull ghcr.io/xxx/common-images/deployer:xxx-test
      xxx-test: Pulling from xxx/common-images/deployer
    

    It seems we would need to switch back to similar printf way if this action does not like the retry mechanism implemented

          - name: Login to GitHub Container Registry
            shell: bash
            env:
              DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              DOCKER_USER: ${{ github.actor }}
            run: |
              for attempt in 1 2 3 4 5; do
                printf '%s' "$DOCKER_TOKEN" \
                  | docker login ghcr.io -u "$DOCKER_USER" --password-stdin \
                  && exit 0
                backoff=$((attempt * 5))
                echo "docker login attempt $attempt failed; retrying in ${backoff}s" >&2
                sleep $backoff
              done
              echo "docker login failed after 5 attempts" >&2
              exit 1
    

    it could be set to no retry by default and allow people to decide if they want retries enabled or no.. I don't see any drawback there.

  15. crazy-max commented on May 22, 2026

    @crazy-max
    Member

    @jprecuch Thanks for the extra context.

    The runner example is useful, but I don't think it changes the conclusion for docker/login-action.

    That retry happens while GitHub Actions is preparing a job or service container. In that path the runner owns the whole lifecycle: it creates the temporary Docker config, logs in if needed, pulls the image, starts the container, and cleans up. Retrying there is scoped to runner-managed container startup.

    docker/login-action is a normal workflow step, and adding retry knobs here would still leave the same class of failures spread across setup, bootstrap, pulls, cache operations, pushes, manifest creation, and other registry operations. Each action would still need to define its own retry policy and decide which failures are safe to retry across Docker Hub, GHCR, GAR, ECR, Harbor, Quay, and custom registries.

    For GHCR specifically, the runner behavior also looks like GitHub handling flakiness or special auth behavior in their own container startup path. That doesn't mean login-action should reproduce the same policy for every registry.

    The part I disagree with is that there is no drawback. Docker CLI exit codes are too coarse to reliably distinguish transient registry problems from bad credentials, permission problems, token propagation delays, rate limiting, or registry-specific auth behavior. Retrying can hide real configuration errors, waste runner time, and make rate limiting worse.

    So I still don't think adding action-specific retry/backoff logic to login-action is the right direction.

  16. cbeauchesne commented on Jun 5, 2026

    @cbeauchesne

    Upvote this issue. Many errors are coming from :

    1. transient networks issue
    2. or from rate limits.

    By adding this feature inside the action, we could have a retries for the first class of issue, but not for the second. Otherwise, users will need to implement the retry mechanism themselves, and very probably, they will do it regardless the issue, and it'll exacerbate the use case 2..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions