Containerising an SS7 stack: the hard part was the build, not the runtime

The STP images compile three Osmocom libraries from vendored source, and each partner's image is four lines on top of that — a `FROM`, one `COPY` of a config template, and `CMD ["/init"]`.

Containers

The STP images compile three Osmocom libraries from vendored source, and each partner's image is four lines on top of that — a FROM, one COPY of a config template, and CMD ["/init"].

Three images, one of them real

base/ builds libosmocore, libosmo-netif and libosmo-sigtran in order (1.11.0 for libosmocore, which libosmo-sigtran needs), configured as the STP wants them:

./configure --enable-osmo-stp --enable-sccp --enable-prometheus --with-microhttpd

Partner A's image and Partner B's image add a single osmo-stp.cfg.tpl each. All the per-carrier difference — point codes, routing, address hiding — lives in that template and is rendered by envtpl at container start. No carrier gets its own binary (one base image, two thin variants), so there is nothing to diff between them but config.

The Dockerfile has three stages. build compiles; test is FROM build and runs the suites; the final stage is also FROM build and does rm -fr /usr/src/*. Tests therefore run on exactly the libraries the shipped image contains, and the shipped image contains neither the sources nor the test run.

A vendored autotools tree does not survive a clean checkout

The first commit (17 April 2025) was the Osmocom source and a Dockerfile that built. It built on my machine. The next day went on three commits (two tickets, CW-2122 and CW-2212) that have nothing to do with SS7.

Each vendored tree carries its own .gitignore, and upstream ignores generated files that upstream regenerates. So m4/*.m4 and the .map linker version scripts were never committed, and a CI checkout had no autoconf macros at all. autoreconf failed on a tree that was complete locally. The fix was unglamorous: delete two lines of .gitignore, commit the macros (369 lines) and the version scripts (2,050 lines), and pass -I m4 explicitly so the include path stops depending on luck.

Two more of the same shape followed. The version string is derived from git, and the build container has no repository (one more commit, 18 April). And the pipeline requires a test target, which at that point was a stub to satisfy it.

Tests that ask the kernel what it can do

make test is docker buildx build --target test against the layers make build just cached (so nothing recompiles to run them). Inside, each library's own make check runs, then standalone unit tests rebuilt with sanitizers:

make -B -f Makefile.$1 test CC="gcc -fsanitize=address,undefined -fno-sanitize-recover=all"

Every step runs even when an earlier one fails, and the summary lists what failed with per-step timings. That matters more than it sounds: a suite that stops at the first failure tells you one thing per CI round trip.

Two of those suites depend on the host kernel, not on the image. io_uring and SCTP differ between runners, so the script probes instead of assuming — a short Python program calls io_uring_setup directly (syscall 425, the same number on x86_64 and arm64) and opens an IPPROTO_SCTP socket. The results switch the io_uring tests on or off and, on a runner with no SCTP, skip one case by name (TESTSUITEFLAGS=-k !socket_sctp). The header line of every run prints kernel=, nproc= and both probe results, so a failure that only happens on one runner is diagnosable from the log.

The variant images are tested differently, because there is nothing to compile in them. test-stp-config.sh starts the image once per deployment env file, renders the template, and runs osmo-stp under timeout. Exit 124 is the pass: timeout had to kill a process that was still running, which means the config was accepted (osmo-stp exits immediately on one it rejects). 137 also passes — it was still shutting down two seconds later, which happens on CI runners. The output is grepped for bind failures, and where the kernel has no SCTP the listeners cannot bind, so only the config itself is checked there.

Keeping a variant honest about its base

Every base image is labelled with the git tree hash of the directory it was built from:

DOCKER_BUILD_ARGS=--label base-tree=$(shell git rev-parse HEAD:./)

A variant build runs ensure-base-image.sh, which pulls a published base and uses it only when that label matches this checkout's base/. Otherwise it builds base locally and tags it (wireless-stp-base:build, the name the variant Makefile expects). So a change under base/ is always built and tested together with the variants that sit on it — on a pull request, and on the push to main that races the base workflow publishing its own image.

There is no Kubernetes in any of this. It is Docker on dedicated hosts, started from Ansible, two images and a config template each; the interesting engineering went into making a twenty-year-old autotools tree reproducible, not into the orchestration.