Skip to content

Start the host helper from Berthward's own image - #14

Merged
thecode merged 1 commit into
mainfrom
host-helper-own-image
Nov 25, 2026
Merged

thecode merged 1 commit into
mainfrom
host-helper-own-image

Conversation

@thecode

@thecode thecode commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Problem

host <command> starts a short-lived privileged helper container that steps into the server's namespaces. That helper used a separate image, alpine:3.21:

  • it had to be downloaded from Docker Hub on first start, before the server scan and the first host command could work;
  • its version was written by hand in a script, the README and the template, where Dependabot does not see it;
  • Unraid's Docker page lists it as an "orphan image" in Advanced View, which looks like something left behind.

Change

The helper needs one program from its image, nsenter, and Berthward's image has it. So the helper is now started from the image the container itself runs.

  • host: starts the helper from the container's own image, with nsenter in place of the image's start command and without its health check. If the image cannot be found (no Docker socket), it stops with a clear message and exit status 69.
  • New self-image: prints the image ID of the container it runs in. The container's ID is read from /proc/self/mountinfo, so it works whatever the container's name or hostname is.
  • Entrypoint: looks the image up once and hands it on as BERTHWARD_SELF_IMAGE, so a host command from Claude or the Discord bridge does not ask Docker each time. A shell opened with docker exec looks it up per command. The download of the helper image at start is gone.
  • Plain environment: the command gets only PATH and HOME, as it did with Alpine. Without this the image's locale setting reached the server's shell and made it print a warning on every command.
  • Setting removed: there is no fallback image and no Host Helper Image field any more (template, README). A saved template from an earlier version still passes HOST_HELPER_IMAGE=alpine:3.21; it is ignored, so existing installs switch over on update without an edit.

The main container stays unprivileged, and the helper is as privileged as before; only the image behind it changed.

For existing installs

After updating, the alpine:3.21 image is no longer used and can be deleted, and the Host Helper Image field in the saved template does nothing and can be removed. docs/getting-started.md says so.

Testing

  • tests/run.sh: ten new checks for host (own image used, handed-on image used without a lookup, a handed-on value that is not an image ID is looked up again, the old setting is ignored, refusal with status 69 when the image cannot be found, usage error first, plain environment). All 489 pass, and the 129 bridge tests pass.
  • Smoke test: nsenter runs as the entrypoint of the built image.
  • On the dev server, with the Alpine image deleted and a saved template that still names it: the start-up scan, exit codes, piped input and quoting work, Alpine is not pulled again, and no containers or volumes are left behind. Tried with the flash drive mounted read-only (a write is refused) and read-write (a file was written and removed), and with a host command sent from Discord.
  • Time per host command: 331–368 ms with the image handed on, against 331–353 ms with Alpine before.

host started its short-lived privileged helper from a separate alpine:3.21 image, which had to be downloaded on first start, was pinned by hand and showed up as an orphan image on Unraid's Docker page. The helper only needs nsenter, which this image has, so it is now started from the container's own image. The separate helper image, its download at start and the Host Helper Image setting are gone; a template that still passes HOST_HELPER_IMAGE is ignored. The entrypoint looks the image up once and hands it on, and the command gets a plain environment instead of the image's.
@thecode thecode added the enhancement New feature or request label Nov 25, 2026
@thecode
thecode merged commit ef7740d into main Nov 25, 2026
5 checks passed
@thecode
thecode deleted the host-helper-own-image branch November 25, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant