Containers

The base image and what it carries, running it as shipped, inheriting to add system packages or Python dependencies, offline and multi-arch builds, and capturing an operator image for recovery.

exocomp ships as one container. This page covers running it, extending it by inheriting from it, and recovering it. The decisions behind it are Decision 0016; the recovery chain it plugs into is disaster recovery.

Status

Piece State
Base image builds and runs (make image), doctor green shipped
Inheriting from the base (FROM exocomp) supported
Published ghcr.io/agync/exocomp (multi-arch, digest) shipped (.github/workflows/publish.yml)
uv self-bootstrap; PATH-delegated ansible with PYTHONPATH decided in Decision 0016, lands with the packaging work
COPY --from into a foreign base deferred (Decision 0016, Scope)

The units reference the published ref. To run a local build instead, substitute localhost/exocomp:dev (make image) for the image name below.

What the base image carries

  • exocompd (the single binary and CLI) and the pinned subprocess tools: tofu, restic, age, sops, nono, litestream (Decision 0012), plus git, openssh-clients, zstd for the git backup leg (disaster recovery) and ping from iputils. The build drops the package's arping and clockdiff, which carry cap_net_raw, so the image adds no file capability. See ping checks.
  • The baked Python + ansible-core toolchain, and uv/uvx pinned by digest (bill of materials).
  • The toolchain interpreter, a uv-managed install in /opt/exocomp/python (UV_PYTHON_INSTALL_DIR, with UV_PYTHON_DOWNLOADS=manual, so only an explicit uv python install fetches one). The job and resolver sandboxes grant that directory read-only, so a per-source venv and the shared toolchain start under enforcing. The grant follows the variable and is dropped when the directory is inside the data dir. A derived image that moves the interpreter must change the variable with it, and an interpreter that the Decision 0006 escape hatch installs elsewhere is not readable by jobs, so reuse the image's. exocomp doctor names the grant under sandbox:.
  • Contract to preserve when inheriting: USER 1000:1000, data volume /var/lib/exocomp, XDG_DATA_HOME=/var/lib, the toolchain on PATH, ENTRYPOINT/CMD unchanged.

Run it as shipped

make image
podman run --rm localhost/exocomp:dev doctor

Under systemd use the Quadlet unit; under Docker use the compose file (platform contract). Both mount /var/lib/exocomp; that volume is the only state, and it is what every backup leg copies.

Two Quadlet constraints the unit keeps but no longer spells out in comments: it sets no Tmpfs= on the data dir — under the rootless UserNS=keep-id posture podman rejects one ("the 'noswap' option is only allowed with rootful tmpfs mounts") and the container will not start; staged secret material lives in /dev/shm, the RAM-backed tmpfs every rootless container has anyway. And it sets no [Service] Type= — the generated unit is Type=notify by default and conmon supplies READY=1, so it works without exocompd calling sd_notify.

Reaching the web surface

Both units publish the web surface on 127.0.0.1:8642 (token-gated TLS) and map the state backend's 127.0.0.1:8643 (bearer-gated), and nothing else. That mapping does not reach the backend, as described below. The web listener needs a token before it starts: serve refuses a non-loopback bind while no token is active (Decision 0009), and a unit that bound anyway would crash-loop under Restart=always. Mint the first one against the volume, before the unit starts:

podman run --rm --userns keep-id -v systemd-exocomp:/var/lib/exocomp \
  ghcr.io/agync/exocomp:latest --no-input token new web

The volume name is the generated one for the Quadlet, created when exocomp-volume.service starts. Compose prefixes the compose file's directory (packaging_exocomp-state for packaging/compose.yaml). The unit runs with UserNS=keep-id, so every command that writes to the volume has to as well. A volume first written without it belongs to a different user, and serve then fails with open /var/lib/exocomp/serve.lock: permission denied.

Inside the container the listener has to bind 0.0.0.0 to be reachable through the published port, which is why Exec=serve --web-addr 0.0.0.0:8642 differs from the host service's loopback bind in the quickstart.

The unit also needs a host-key passphrase outside the volume before it starts. A systemd user manager cannot decrypt a host-scope credential (systemd-creds --with-key=host is root-only and the user manager rejects the file with Scope mismatch), so the shipped unit uses the passphrase tier: host.key.age in the volume, a random passphrase in ~/.config/exocomp/host-key.passphrase outside it, passed in as a plain systemd credential and named with EXOCOMP_HOST_KEY_PASSPHRASE_FILE. Create it and run the first-run wizard against the volume before the first start; the full sequence is in bootstrap.

The state backend and /metrics on :8643 bind the container's own loopback, which a published port does not reach. Under rootless podman 5.8 with pasta the connection to 127.0.0.1:8643 on the host is accepted and then reset. Reach them from inside the container, or run the container with Network=host. The host's loopback is then the container's. Drop the PublishPort= and Sysctl= lines (ping checks) and bind the web surface to 127.0.0.1:8642 in the Exec= line, as the host service does, because 0.0.0.0 would then be every host interface.

Compose first run

The shipped compose file bind-mounts the host-key passphrase from outside the checkout, so the wrapped key in the volume is useless without the host file. The file must be readable by the container user — 0644 — because the container's uid does not map to the host user under rootless Podman or a default Docker userns. Keep it in a directory only your account can enter (0700); the file is world-readable, so the directory is what keeps other local accounts out. On a Podman host the alternative is 0600 plus userns_mode: keep-id, which Docker rejects, so the shipped file does not set it.

The mount carries the shared SELinux relabel (z), not the Quadlet's private Z: the one-off compose run container and the long-lived service both mount the file, and Z would relabel it per container and break the other. On a host without SELinux the relabel is a no-op, and a filesystem without SELinux xattrs (NFS, SMB) cannot take it, so keep the file on local storage.

Create it, then run the first-run verbs through the same service so they use the volume and mount up will:

export EXOCOMP_HOST_KEY_PASSPHRASE_FILE=$HOME/.config/exocomp/host-key.passphrase
install -d -m 700 ~/.config/exocomp
openssl rand -base64 32 > "$EXOCOMP_HOST_KEY_PASSPHRASE_FILE"
chmod 644 "$EXOCOMP_HOST_KEY_PASSPHRASE_FILE"

docker compose -f packaging/compose.yaml run --rm exocomp --no-input token new web
docker compose -f packaging/compose.yaml run --rm exocomp setup
docker compose -f packaging/compose.yaml up -d

compose run allocates a TTY for setup and mounts the file at /run/secrets/host-key.passphrase. The variable is needed for every compose verb, not just up: ps, logs and down fail the same interpolation when it is unset, so keep the export in the shell or wrapper that runs the stack. token new before setup is fine: setup only refuses when a host key already exists.

The build: stanza builds from this checkout; on a host without the source, pull the image first with docker compose -f packaging/compose.yaml pull.

The z relabel is a permanent change to the file's SELinux type (container_file_t, shared), which is why it is a dedicated passphrase file rather than something reused.

An install that already has a plaintext host.key in its volume keeps using it until identity migrate --rotate-host replaces it with a newly minted passphrase-wrapped key. Stop the stack first: identity migrate refuses while serve holds the lock.

docker compose -f packaging/compose.yaml down
docker compose -f packaging/compose.yaml run --rm exocomp identity migrate --rotate-host
docker compose -f packaging/compose.yaml up -d

--rotate-host mints a new host identity, re-wraps the keyring to it and removes the plaintext host.key; exocomp doctor then reports passphrase-wrapped. The generation bump makes the printed kit's version line stale: exocomp recovery-kit re-renders the card's structure — the current generation, recipients, fingerprints, salt and restore recipe — but not the recovery secret key, which is printed once and never stored. Keep the printed page (disaster recovery).

On a Podman host, run the Compose file through podman's Docker-compatible socket rather than podman-compose:

systemctl --user start podman.socket
export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock

Running commands against the container

The image carries the binary as exocompd, with the whole CLI behind it: podman exec exocomp exocompd doctor.

Reads and enqueues work from the host through a remote (exocomp --remote <name> jobs list, playbook run, drain). drain needs the remote named, and exocomp login pins it (remote access). Config writes stay local (remote access), and local means the data volume. Run them in the container: podman exec exocomp exocompd source add homelab --path /srv/homelab. On the host, exocomp source add writes to the host's own data dir and the daemon never sees it. A path source has to exist inside the container at the path you register, so mount the tree with an extra Volume= line.

A playbook run started from the host and one started in the container both end up on the daemon, but they reach it differently.

exocomp --remote <name> playbook run on the host podman exec exocomp exocompd playbook run
How it reaches the daemon /api/v1 over TLS, with a bearer token the data volume, as the local operator
Paths it names on the daemon, as a --source and a registered inventory, or absolute paths in the container
Who runs the job the daemon, and the command follows it the daemon (job N queued for the running daemon), and the command follows it

A remote run refuses --privileged, and remote access lists the other inputs that do not cross the wire. Without --remote or EXOCOMP_REMOTE, exocomp playbook run on the host runs the job on the host, against the host's own data dir, and the container never sees it. In the container, a command run while the daemon is stopped runs the job itself.

Managing the host the container runs on

A job reaches the host the container runs on the way it reaches any other target, over SSH. A local connection would run become inside the sandbox, which denies it, and the container does not see the host's files. The host runs sshd, and the container connects to it on loopback. That needs Network=host, because under the shipped unit's network 127.0.0.1 in the container is the container's own loopback. Drop the PublishPort= and Sysctl= lines and bind the web surface to 127.0.0.1:8642 as reaching the web surface describes, or it listens on every host interface.

  • The key. Generate a key pair for the daemon on the host, outside the data volume, and authorize its public half for the target user, both from configuration management. The private key reaches the container through a read-only bind mount, and each run is granted it as a single file (read grants for ssh identity files). Keep it outside the data dir.

    # exocomp.container
    Volume=/path/to/keys/self:/run/keys/self:ro
    

    On an SELinux host the directory also needs a label the container can read, which z or Z in the mount options sets. Z keeps it private to this container, as the unit does for the host key credential.

  • The restriction. The authorized key accepts loopback sources only, so a copy of it used from another machine is refused:

    from="127.0.0.1,::1" ssh-ed25519 AAAA... exocomp@host-a
    

    With Network=host the container's connection reaches sshd from loopback, so this matches.

  • The inventory and the run. The host is an ssh target on loopback, and become runs on the far side of the connection, outside the sandbox:

    host-a:
      ansible_host: 127.0.0.1
      ansible_user: user-a
      ansible_ssh_private_key_file: /run/keys/self/id_ed25519
    
    podman exec exocomp exocompd playbook run site.yml --source infra --limit host-a \
      --ssh-identity /run/keys/self/id_ed25519
    

    Each job starts with a fresh home, so ssh has no known_hosts of its own. Supply the host's key from the checkout through the inventory.

Moving the daemon to another host

  1. Generate the new host's key and authorize it, loopback only, on the new host's sshd, mounted into the container as above.
  2. Move the daemon and its data volume (cold-standby failover covers a replicated store).
  3. Run a playbook from the new host against itself, then against every other target.
  4. Revoke the old host's key on the old host.

If the daemon still manages the old host, it now reaches it over the network like any other target, with a key whose authorization is not limited to loopback.

Resolving host names under the sandbox

The published image is a Fedora container base with no /etc/nsswitch.conf, so glibc resolves over UDP DNS, which the job sandbox blocks. A job that dials a host by name, an SSH connection to an inventory FQDN above all, cannot resolve it. The dependency resolvers do not rely on this, because their proxy resolves names for them, and inventory entries that are addresses need nothing.

A host whose nsswitch.conf uses resolve reaches systemd-resolved over a unix socket instead, and the container can do the same. Mount /run/systemd/resolve read-only, and mount a file containing hosts: files resolve [!UNAVAIL=return] dns at /etc/nsswitch.conf. The base ships libnss_resolve, which a derived image has to keep. Raw UDP stays blocked. This is verified on Fedora with SELinux enforcing, where the directory mount needs no relabel and the file mount takes :z. podman exec exocomp getent hosts <fqdn> checks the mounts and the configuration.

The socket is the cost. Landlock does not mediate a connect to a pathname unix socket, so every sandboxed job can then reach the host's resolver, which the threat model records. Where that is not acceptable, give the inventory an ansible_host that is an address.

Ping checks

ping checks and the ping verify gates of a workflow run the image's ping from the daemon, with no capability. The kernel allows that when the network namespace's net.ipv4.ping_group_range covers the gid the daemon runs as. Podman sets the range to 0 0 in a container's own network namespace, so both shipped units set it to the image's gid:

Sysctl="net.ipv4.ping_group_range=1000 1000"

That is the group of USER 1000:1000. UserNS=keep-id keeps the image's user and adds the host user's group as a supplementary one, so the value does not depend on the host, and a derived image keeps it by keeping that user. Keep the quotes, or Quadlet splits the value at the space. Compose sets the same key under sysctls:.

With Network=host the host's range applies, and systemd's default covers every group. Podman refuses a network sysctl in the host's namespace and the container does not start, so drop the Sysctl= line along with the PublishPort= lines. Under compose with network_mode: host, drop sysctls: along with ports:.

The range only applies inside the container's network namespace, and a sandboxed job still cannot open an ICMP socket, because nono refuses it whatever the range. A tcp check needs neither.

Ansible's remote temp

The image's user has no home of its own in /etc/passwd. Under UserNS=keep-id podman adds an entry whose home is /. For a local connection ansible expands its default remote temp, ~/.ansible/tmp, through that entry, to /.ansible/tmp, which no job can write. The sandbox sets remote temp to $HOME/.ansible/tmp instead. A local connection expands it to the job's own home and an ssh target to its user's home, so neither needs an ansible_remote_tmp in the inventory. See running a playbook.

Add a system package

A playbook that shells out to a binary the base does not carry gets it by inheriting:

FROM ghcr.io/agync/exocomp:0.1.0
USER root
RUN dnf install -y --setopt=install_weak_deps=0 rsync sshpass \
    && dnf clean all
USER 1000:1000

Version-pin the packages and end on USER 1000:1000. Two things to know: a system binary a job runs must be reachable under the job sandbox, so a nono grant is needed and exocomp doctor reports the addition; and this is the one seam Decision 0011 leaves out of runtime scope, which is why it is an image change and not a manifest change.

When running a custom derived image under systemd, update both Image= and Environment=EXOCOMP_IMAGE= in ~/.config/containers/systemd/exocomp.container so the unit executes your image tag and records it for disaster recovery (Decision 0016).

Add Python dependencies

Prefer the declared-manifest path. A project's root requirements.txt or pyproject.toml (PEP 621 / dependency-groups) is resolved by uv into a per-source, hash-gated venv — offline after the first resolve (Decision 0011). A source that declares nothing stays on the shared toolchain.

To change the shared toolchain itself, the operator escape hatch applies uv at a shell into the data volume, so the switch persists, rides in backups, and is visible to doctor (Decision 0006):

uv tool install --python <interpreter> ansible-core==<version> --with <module-dep>

doctor prints the active manifest path and marks each tool whose resolved version is off its MANIFEST.json pin as a warn (restic 0.19.1 — pinned 0.19.0): the switch is a supported state made visible, not a fault.

Do not bake Python libraries into an image you only use for one project; the manifest path is the supported one. Baking is for a dependency every run needs.

Pin a different ansible-core

Today the image pin moves through the Decision 0006 escape hatch or an image rebuild; a per-source venv does not override it. Decision 0016 changes this: the fallback toolchain is exocomp-managed and a project that declares ansible-core in its manifest shadows it. Landed behavior follows that record.

Offline and air-gapped

A resolve is hash-gated, so a stable manifest never dials out. For a host with no network, vendor collections and providers first — see offline caches. An image built for an air-gapped host must carry its base images and the wheelhouse; uv runs with --offline.

Multi-arch

The base is published as a manifest list (amd64, arm64). Publish a derived image for the same platforms, and pin FROM by @sha256: rather than a tag so a rebuild does not silently drift.

.github/workflows/publish.yml builds that list. Each architecture builds on its own runner (ubuntu-24.04, ubuntu-24.04-arm) rather than under emulation, so no qemu is involved, and the build passes TARGETARCH explicitly because the tool downloads are arch-specific. Per-arch tags are pushed as :build-amd64 and :build-arm64, then a manifest job assembles them into the list and pushes :latest, plus the version tag when the run came from a tag. It runs on pushes to main, on v* tags, and on workflow_dispatch.

The registry login needs no secret: ghcr.io/agync/exocomp is the repository owner's namespace, which is the one a workflow's built-in GITHUB_TOKEN can write. Set the IMAGE_NAME repository variable to publish elsewhere, such as a fork's own namespace.

The build passes the release version into the binary — the same three stamps make build injects — so a published image names its release in doctor and on the recovery card instead of reading dev.

Disaster recovery of a custom image

A local image tag lives in the store of the host that can fail, so it is not a backup. Capture the image you run into the recovery set:

podman save -o exocomp-image.tar <image-ref>

and record the image ref and every source base digest in RECOVERY.md (disaster recovery). A registry tag may be used to install; recovery must not need it (invariant 7). podman load -i FILE (or docker load -i FILE on the Docker tier) loads the captured archive with the detected engine before the Quadlet units start. The unit's EXOCOMP_IMAGE is what the daemon records, so the image-ref: line in RECOVERY.md and exocomp doctor name what actually runs.

Updating and rollback

Rebuild a derived image when its base digest moves, then roll the unit forward with the normal upgrade path (upgrade and rollback). An old image tag is a rollback target; keep the previous one until the new one has run a backup and a restore drill.

Connections

Local graph

Linked from