Add apt retry config to Dockerfile to handle transient mirror sync failures#155
Merged
vharseko merged 2 commits intocopilot/make-rest-context-path-configurablefrom Apr 10, 2026
Conversation
…ror sync errors Agent-Logs-Url: https://github.com/OpenIdentityPlatform/OpenIDM/sessions/5bb14e72-067d-4039-b113-fa9d2dca0d71 Co-authored-by: vharseko <6818498+vharseko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add apt retry logic to handle transient Ubuntu mirror issues
Add apt retry config to Dockerfile to handle transient mirror sync failures
Apr 9, 2026
maximthomas
approved these changes
Apr 10, 2026
5f5835a
into
copilot/make-rest-context-path-configurable
14 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
apt-get updatefails intermittently onlinux/ppc64ledue to Ubuntu mirror sync races (File has unexpected size … Mirror sync in progress?), breaking the multi-platform Docker build.Changes
Dockerfile: Write an apt config file beforeapt-get updateto enable 3 automatic retries on fetch failures:Dockerfile-alpine: No change — usesapk, unaffected.Original prompt
Problem
The
build-dockerjob is failing becauseapt-get updateencounters a transient Ubuntu mirror sync issue on thelinux/ppc64leplatform. The error is:This causes the entire Docker multi-platform build to fail.
Failing job: https://github.com/OpenIdentityPlatform/OpenIDM/actions/runs/24202286864/job/70648875986?pr=142
Solution
Use apt's built-in
Acquire::Retriesoption to add retry logic to theDockerfile. This handles transient mirror issues gracefully without needing a shell retry loop.Changes required in
DockerfileOn line 27, prepend a command that configures apt retries before running
apt-get update:Before:
RUN apt-get update \ && apt-get install -y --no-install-recommends curl unzip \After:
The rest of the
RUNcommand (lines 29-38) should remain unchanged. Only add theecho 'Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries &&prefix beforeapt-get update.Also apply the same fix to
Dockerfile-alpineif it usesapt-get updateCheck
Dockerfile-alpine— if it usesapkinstead ofapt, no change is needed there.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant:
I'll start by fetching the job logs and the workflow definition to understand the failure.
Assistant: ## Failing Job Analysis
The build-docker job is failing due to a transient Ubuntu mirror sync issue on the
linux/ppc64leplatform during the Docker multi-platform build.Root Cause
The error is:
This is a well-known transient issue where the Ubuntu package mirror is mid-sync and the
apt-get updatefails because the downloaded index file doesn't match the expected checksum/size. Theapt-get updatefailure causes the entireRUNlayer to fail, which causes the Docker build to fail forlinux/ppc64le. Since the image wasn't pushed to the local registry, the subsequentdocker runtest also fails withmanifest unknown.Solution
There are a few approaches to make this more resilient:
Option 1: Add retry logic to
apt-get updatein the Dockerfile (Recommended)In
Dockerfileat line 27, replace the singleapt-get updatewith a retry loop:Option 2: Use
Acquire::Retriesfor aptA cleaner apt-native approach:
Option 3: Re-run the workflow
Since this is a transient mirror issue, simply re-running the failed job may succeed if the mirror has finished syncing. However, this doesn't prevent future occurrences.
Additional Note
The workflow at line 147 already has
continue-on-error: trueon the build step, but the subsequent Docker test step (line 157) does not havecontinue-on-errorand doesn't check whether the image was actually built before trying to run it. You could guard the test: