Repository navigation
docs: show how to run fctl sessions in an image on another base - #16
Conversation
Add examples/ubuntu/Dockerfile, which makes Ubuntu 24.04 into an image fctl sessions run in (fctl, Claude Code, git, gh and a user other than root; fctl-agent comes from the host), and examples/check.sh, which checks any image for what fctl needs of it. The Examples workflow builds the example for amd64 and arm64 and checks it when it changes.
|
fctl reviewed Reviewed by fctl · Review agent settings |
| # Claude Code, the native build, in ~/.local/bin, as the user. Claude and its | ||
| # commands find their tools through the image's PATH, and so do setup | ||
| # scripts: Ubuntu's login shells keep it. |
There was a problem hiding this comment.
Comment wrongly says login shells keep the image's PATH
Low severity. Ubuntu's /etc/profile rebuilds PATH from a fixed list, so a login shell does not keep ENV PATH; ~/.local/bin only survives because /etc/skel/.profile re-adds it when the directory exists. Someone who follows "add your own steps" and adds ENV PATH=/opt/tool/bin:$PATH finds the tool in Claude but not in setup scripts, which run in a login shell, and examples/check.sh only tests git, claude and fctl, so it passes. The main image avoids this with /etc/profile.d/fctl.sh (provision.sh), and AGENTS.md says the PATH must match in both places.
| # Claude Code, the native build, in ~/.local/bin, as the user. Claude and its | |
| # commands find their tools through the image's PATH, and so do setup | |
| # scripts: Ubuntu's login shells keep it. | |
| # Claude Code, the native build, in ~/.local/bin, as the user. Claude and its | |
| # commands find their tools through the image's PATH. Setup scripts run in | |
| # login shells, which on Ubuntu rebuild PATH from /etc/profile: ~/.local/bin | |
| # survives through ~/.profile, but a directory you add with ENV PATH needs a | |
| # file in /etc/profile.d/ too. |
Found by fctl review in b81e8e8.
There was a problem hiding this comment.
Not a problem, so I've left the comment as it is. Ubuntu 24.04's /etc/profile doesn't set PATH: it only sources /etc/bash.bashrc for interactive shells and /etc/profile.d/*.sh. Debian's /etc/profile is the one that rebuilds PATH from a fixed list, and so does Alpine's. I checked this in the example image built from this branch, with an extra directory on the image's PATH as the finding describes:
image: /opt/tool/bin:/home/agent/.local/bin:/usr/local/bin:/usr/bin:/bin
login: /home/agent/.local/bin:/opt/tool/bin:/home/agent/.local/bin:/usr/local/bin:/usr/bin:/bin
The login shell keeps /opt/tool/bin; ~/.profile only adds ~/.local/bin in front again. fctl's docs (hyperstructure/fctl#610) make the same distinction: Ubuntu's login shells keep the image's PATH, while images on Debian or Alpine need /etc/profile.d, as the default image has it. examples/check.sh caught exactly that on an Alpine build.
…heck cat docker run IMAGE sh -s hands sh -s to the image's ENTRYPOINT, which fctl sessions never run: the commands now pass --entrypoint sh. The host also runs cat in sandboxes, so examples/check.sh looks for it.
|
hyperstructure/fctl#610 is merged. Its Sandbox images page links to |
Summary
People with an image of their own that doesn't start from this one (a company's Ubuntu image with its own toolchains, say) had no worked example of what to add for fctl. This adds
examples/ubuntu/Dockerfile, which makes Ubuntu 24.04 into an image fctl sessions run in: fctl from its installer for every user, Claude Code as the user, git, gh, bash, sudo and/var/cache/fctl. It installs no fctl-agent, because the host copies its own into each sandbox when a session starts. It also addsexamples/check.sh, which people can run against any image to see what fctl still needs (docker run --rm -i --entrypoint sh IMAGE -s < examples/check.sh, in place of the image's entrypoint, as sessions run), and a README section, Another base, that points to both and to fctl's docs.The new Examples workflow builds the example for amd64 and arm64 and runs the check in each, when
examples/changes. The published image is unchanged. I had no Docker in the session, so I built the example with buildah on arm64. The check passes on it, onghcr.io/hyperstructure/sandbox:latestand on an Alpine variant, and it lists what's missing on plainubuntu:24.04. I also started fctl-agent in the built image as the host does (root, with Claude's user as uid 1000).Worth confirming
Decision: The example removes the
ubuntuuser that Ubuntu's images ship (uid 1000) and addsagent, as the default image has. Sessions could equally run asubuntu, and the docs say so.Decision:
examples/check.shfails on what sessions can't do without (bash, git, Claude Code 2.1.101 or later, fctl, a user in/etc/passwdwith a writable home, git over HTTPS). It only warns about running as root, a missing gh and an unwritable/var/cache/fctl, which sessions survive.docs: show how to run sessions in an image on another base fctl#610
fctl session
Note
Low risk. It adds documentation, an example Dockerfile, a check script and a CI workflow, and changes no code that the published image runs.
What it does. Shows how to build an fctl sandbox image on another base: a README section, an Ubuntu example Dockerfile, and
examples/check.sh, which checks an image for what fctl needs. A new Examples workflow builds and checks the example on both architectures. The check is run with--entrypoint sh, so an image's own entrypoint doesn't swallow the script.fctl review's first look at
7d5b83b· 7 files, +227 −5 · Review agent settings