Skip to content

docs: show how to run fctl sessions in an image on another base - #16

Merged
kalaspuff merged 2 commits into
mainfrom
fctl/1526-it-should-be-documented-in-our-docs-and
Nov 20, 2026
Merged

kalaspuff merged 2 commits into
mainfrom
fctl/1526-it-should-be-documented-in-our-docs-and

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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 adds examples/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, on ghcr.io/hyperstructure/sandbox:latest and on an Alpine variant, and it lists what's missing on plain ubuntu: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 ubuntu user that Ubuntu's images ship (uid 1000) and adds agent, as the default image has. Sessions could equally run as ubuntu, and the docs say so.

  • Decision: examples/check.sh fails on what sessions can't do without (bash, git, Claude Code 2.1.101 or later, fctl, a user in /etc/passwd with 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

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-review

fctl-review Bot commented Nov 20, 2026

Copy link
Copy Markdown

fctl reviewed b81e8e8 and found 1 issue.

Reviewed by fctl · Review agent settings

Comment on lines +44 to +46
# 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@fctl-sh

fctl-sh Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

hyperstructure/fctl#610 is merged. Its Sandbox images page links to examples/ubuntu/Dockerfile and examples/check.sh on this repository's main, and tells people to download examples/check.sh from there. Those links lead nowhere until this pull request merges.

@kalaspuff
kalaspuff merged commit 001a1d8 into main Nov 20, 2026
8 checks passed
@kalaspuff
kalaspuff deleted the fctl/1526-it-should-be-documented-in-our-docs-and branch November 20, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant