One base image, five instances, and every config rendered at boot

A Diameter routing agent whose config files do not exist until the container starts, and the three failures that shape made visible.

Telecom

Nothing in these images ships a finished config. freeDiameter.conf, resolv.conf and fixups_config.json are all generated at container start from a .tpl beside them, each one prefixed with a banner that names the template:

# DO NOT EDIT THIS FILE
# This file is re-generated from freeDiameter.conf.tpl at container startup
# Your modifications will be lost.

The banner earns its place (three files, three banners). An operator who edits the live file loses the edit at the next restart; the file says so in the only place they will look. The resolv.conf banner goes further and names the repository the nameservers come from (the Ansible inventory, not this image).

The cascade

One base image carries freeDiameter, the two C routing extensions and the Diameter dictionaries (dict_s6a, dict_cx). Each instance image is FROM that base with only its own config layered on. That ordering is the whole build — base first, then the instances. Two CI commits exist only because of it: validate base→instance cascade build, and isolate main base image from branch builds.

A branch that changes base/ must build its own base, or every instance test on that branch silently measures the previous one. The CI migration (CW-3385, February 2026) moved all of it from Jenkins to GitHub Actions, one workflow per image, and dropped the version from the image tag in favour of a Docker label. A version in the tag means the artifact you promote has a different name from the artifact you tested; a label means the same digest carries the version with it.

Config is validated at boot, not at build

The startup script renders the templates and then checks its own output:

check_hss_fixups_config --strict /etc/freeDiameter/fixups_config.json

A template that renders to invalid JSON fails there (exit non-zero, no daemon), before freeDiameter reads it. The same script waits for rsyslog to come up under s6 (s6-svc -wu) before starting the daemon, because a DRA that boots faster than its log transport loses exactly the messages you want when it misbehaves.

Three failures worth keeping

The bootup race. The container adds its own routes at init (00-container-net), and freeDiameter could start before they existed. The fix was to pre-install the RFC1918 routes in cont-init.d, which runs to completion before any service does — ordering, not retries.

Dictionary load order. CW-3060 Fix order of loading the dictionaries to fix loading error: the Cx dictionary depends on symbols the S6a one registers; loading them in the wrong order fails at startup with an error that names neither.

Routing and translation drifting apart. Dev subscribers are diverted to a development HSS, and the diversion has two halves that have to agree: a un= rule in the routing file, and an IMSI check in the Python transform. They were configured separately, which is one source of truth too many. Now both read a single environment variable (DEV_HSS_IMSIS, comma-separated), the routing rules are rendered into a marked block in rt_default.conf at startup, and the block ships empty — an image with nothing set diverts nothing.

# BEGIN dev IMSI routes — rendered at startup from DEV_HSS_IMSIS
# Empty by design: nothing is diverted unless DEV_HSS_IMSIS is set.
# END dev IMSI routes

Two rules were added around that. A renderer that diverted nothing has to stop the transform diverting too, and a bad value must never stop the DRA from starting — it must also never divert a subscriber without rendering a route for them. Both of those are failure modes that would otherwise be discovered by a subscriber.

What the shape bought

The per-instance diff is config (five files, no code). A fix to the base reaches five images on the next cascade, and an instance can pin behaviour without a branch, because the knobs are environment variables read at boot. The cost is that nothing is inspectable until a container is running: there is no freeDiameter.conf to read in the repository, only the template and the variables that fill it.