Runner container never receives DOCKER_HOST — Quadlet sets it in [Service] instead of [Container] #5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
On a fresh machine, zhuiri.service crash-loops at startup and systemd eventually gives up with start-limit-hit. The runner log shows:
Investigation shows the runner container never sees the DOCKER_HOST variable at all. The Quadlet unit sets Environment=DOCKER_HOST under the [Service] section, which only applies to the podman run CLI process on the host — systemd does not forward it into the container, and the runner image has no DOCKER_HOST baked in.
With config.yml docker_host: "-", the runner (v12.12.0) looks up DOCKER_HOST in its own environment, finds nothing, and falls back to scanning well-known socket paths, where /var/run/docker.sock is checked first. So the daemon ping goes to the wrong socket (or a dead one), and startup fails.
Further findings (all verified on nixos, podman 5.8.6, forgejo-runner v12.12.0):
[Container] Environment=FOO=bargeneratespodman run --env FOO=bar, while[Service] Environment=only sets the env of the podman CLI process.podman rundoes not forward its parent environment into the container:env DOCKER_HOST=... podman run --rm <img> envshows no DOCKER_HOST inside.internal/app/cmd/daemon.go,getDockerSocketPath): withdocker_host: "-"it doesos.LookupEnv("DOCKER_HOST")first; if unset it scanscommonSocketPathsin order,/var/run/docker.sockfirst.PATHandHOME=/data(noXDG_RUNTIME_DIR), so even with the socket mounted at/run/user/1000/podman/podman.sockand no env var, the scan finds nothing and startup fails with "daemon Docker Engine socket not found and docker_host config was invalid".Plan of attack:
quadlet/zhuiri.container: moveEnvironment=DOCKER_HOST=unix:///run/user/%U/podman/podman.sockfrom[Service]into[Container](keeping its comments). Quadlet then passes it via--env; systemd expands%Uin the ExecStart line as it already does for the Volume= paths.podman runof the daemon.