Skip to content

Harden opendj-docker apt step: force IPv4 + retries#743

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-docker-apt-ipv4-retries
Jul 16, 2026
Merged

Harden opendj-docker apt step: force IPv4 + retries#743
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-docker-apt-ipv4-retries

Conversation

@vharseko

Copy link
Copy Markdown
Member

Problem

The build-docker job builds the image for multiple architectures via QEMU emulation. Every arch except amd64 (arm64, ppc64le, s390x, riscv64) installs curl/unzip from ports.ubuntu.com. On GitHub runners the emulated containers frequently have no working IPv6 route, so apt-get update burns its attempts on unreachable v6 addresses:

Err:1 http://ports.ubuntu.com/ubuntu-ports noble InRelease
  Cannot initiate the connection to ports.ubuntu.com:80 (2620:2d:4002:1::10c). - connect (101: Network is unreachable)
...
W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Unable to locate package curl
E: Unable to locate package unzip
#29 ERROR: ... exit code: 100

apt-get update still exits 0 on a failed index fetch, so the build proceeds to apt-get install and dies with "Unable to locate package".

Change

Write an apt.conf before apt-get update that forces IPv4 and enables 5 retries, then remove it during the existing cleanup step so the final image is byte-identical:

RUN  printf 'Acquire::ForceIPv4 "true";\nAcquire::Retries "5";\n' > /etc/apt/apt.conf.d/99-ci-network  && apt-get update  ...
 && rm -rf /var/lib/apt/lists/* /etc/apt/apt.conf.d/99-ci-network ```

Only `opendj-packages/opendj-docker/Dockerfile` is touched. `Dockerfile-alpine` uses `apk` and is unaffected.

## Scope / caveats

This hardens the **common** IPv6-only variant of the flake. It does not cover a full `ports.ubuntu.com` outage (where the IPv4 mirror also times out) — that still needs a job-level re-run. A follow-up option, if this recurs, is to fetch+unzip the dist in a builder stage and drop `apt` from the runtime image entirely.

The multi-arch docker build installs curl/unzip from ports.ubuntu.com
for the QEMU-emulated arches (arm64, ppc64le, s390x, riscv64). On GitHub
runners those emulated containers frequently have no working IPv6 route,
so apt-get update wastes its attempts on unreachable v6 addresses; when
the index fetch fails apt still exits 0, and the following install dies
with "Unable to locate package curl/unzip", failing the whole build.

Write an apt.conf that forces IPv4 and enables 5 retries before
apt-get update, and remove it again during the cleanup step so the
final image is unchanged.
@vharseko
vharseko merged commit ad7df25 into OpenIdentityPlatform:master Jul 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants