Under the hood
How Silo works.
This page is optional. Concepts, configuration, and the command reference cover everyday use. Continue here only if you want the implementation: how a command becomes a session, how images are published, and how mounts and host ports are set up.
From command to workspace
- Discover. Canonicalize the current directory, prefer the nearest
.silo.tomlmarker, otherwise ask Git for its top-level working tree, and silently fall back to the current directory. - Configure. Merge the global file, then the project file, fill omitted defaults, and apply command flags.
- Validate. Reject unknown or unreachable entries, then resolve the lifecycle, image contract, binds, managed state, read-only workspace paths, container settings, and host ports.
- Prepare. Confirm the image/runtime state and establish managed storage and SSH host-port assets where needed.
- Run. Reuse or create the shared project container, or create a one-shot isolated container, then attach the requested shell or command.
- Clean up. Restore the terminal, release the session lease, and remove isolated runtime resources.
Silo has no persistent host daemon. When host ports are active, the host SSH master remains connected only for the lifetime of the shared container and exits when that container stops.
Image build and publication
silo image build builds the runtime base, checks it, then builds the tool layer on top. With no image.dockerfile, that layer is the default extras image, published as silo:latest. A custom Dockerfile replaces the extras and must be a single stage starting with a literal FROM silo-base:latest. Silo rewrites that line so the name is not sent to a registry.
Both images have to build and pass a short startup check before either stable tag moves. A zero exit status means that happened. If publishing the tool image fails after the base tag has already moved, Silo says so and leaves silo-base:latest updated. A running container keeps the image it was created from until the next one is created.
silo image update rebuilds only the tool layer, using the silo-base:latest already on the machine. It does not refresh the entrypoint or the base packages, so a Silo upgrade still needs silo image build. Update also leaves Apple's builder alone. A full build clears that builder, which is shared with any image work you do directly through container.
Builds do not keep a cache, and the same Silo source can produce a different image later because Ubuntu, Homebrew, and the formulae move. A custom Dockerfile is trusted: the startup check looks for the silo user, home, helpers, and shells, and stops there.
Identity and ownership
A shared container name begins with silo- and ends with the first 24 hexadecimal characters of a SHA-256 digest of the canonical project path. The stable name makes concurrent Silo processes converge on the same workspace.
Silo writes four labels: owner, canonical project root, lifecycle, and a unique instance token. Before it joins, stops, replaces, or deletes a container, it validates those labels against the runtime ID and rejects anything that does not match the selected instance.
A matching name alone is never sufficient evidence that Silo owns a container or network.
Management commands inventory only unambiguously Silo-owned resources. They report malformed entries as warnings rather than guessing.
Host user ids
Silo passes its own user and group ids into the container as SILO_UID and SILO_GID. The entrypoint applies them to the silo user before your command starts, which is why new files belong to the Mac account that launched Silo. Names beginning with SILO_ are reserved for that handoff. See file ownership.
Environment forwarding
Allowlisted names are applied only when a container is created. Silo passes each name as --env NAME, with no NAME=value argument, so the value remains in the environment of the creating process and is read by Apple's runtime. Isolated creation and shared creation use the same allowlist.
Attaching to a running shared container uses container exec. That command sets HOME and does not pass the allowlist again, so a later shell cannot refresh names or values. Stopping the container and creating it again reads the environment of the new silo process.
Running-container reuse
A valid running shared container is the current workspace instance. Silo joins it immediately without rebuilding current configuration or comparing creation settings. Changes to the image, mounts, resources, sudo, or host ports take effect after the existing shared container stops and a later command creates a new one.
A stopped owned container is removed and recreated from the current configuration. During creation, Silo checks the selected image digest before and after the runtime command, and retries bounded conflicts instead of accepting a concurrently retagged image.
Reusing a running container preserves its ephemeral state. When a stopped container is recreated, container-local state is lost; the source tree, binds, and configured managed state are host-backed and remain available.
Isolated lifecycle
An isolated run creates a unique container, starts it in the foreground, forwards relevant signals, and deletes the container after the child exits. Interrupted or failed creation paths also attempt cleanup.
Isolated mode uses the same project mount, read-only overlays, binds, managed state, Silo user, and selected derivative image as shared mode. Its container filesystem is disposable, but configured state is not.
Mount resolution and storage
Configured bind sources are expanded, canonicalized, and verified as directories at run time. Managed state receives deterministic host paths and opaque IDs. Silo creates parent directories with private permissions, guards mutations with file locks, and stores project-path metadata beside project-scoped state.
Before using or deleting managed state, Silo checks that directories are real rather than symlinks, ownership metadata matches the expected project, and the derived ID/path are consistent. Deletion additionally asks the runtime whether any container still references the directory.
Every host-backed directory uses Apple's structured --mount bind syntax. Runtime mounts are sorted from shallower to deeper targets so intentional nested mounts are deterministic. Configuration validation resolves targets against the actual project workdir, rejects duplicate effective targets, and rejects read-write binds or state that overlap configured read-only workspace paths in either direction.
Read-only project overlays
Each usable directory in workspace.read_only is mounted again, read-only, on top of the writable project. Missing paths are skipped. A file or a path that leaves the project is skipped with a warning. A writable bind or state mount may not cover one of these paths or sit on top of it.
Apple's filesystem share treats a nested directory as covering neighbors whose names start with its name, so a .git overlay would hide .github. Silo remounts those neighboring directories read-write. Files are left as they are.
Host ports
A container cannot reach a service bound only to the host's 127.0.0.1 through normal container networking. In shared mode, every compatible derivative lets Silo:
- Generate or reuse a managed client identity and a project-specific SSH host identity.
- Mount only the guest host key and a restricted
authorized_keysfile into the container. - Wait for the container's IPv4 address and its restricted SSH server.
- Start or reuse one authenticated SSH master with a reverse tunnel for each configured port.
- Bind every guest listener to
127.0.0.1and target the same127.0.0.1port on the host.
host_ports = [5432]
# Available in the shared container:
127.0.0.1:5432
The SSH client uses Silo's managed identity, exact host-key verification, and no ambient SSH configuration or agent. The guest account cannot open a shell, allocate a terminal, forward an agent, or listen on an unconfigured port.
Tunnel setup belongs to container creation. A later session that joins the running container does not inspect or repair the host SSH process; stopping and recreating the shared container establishes it again.
Isolated runs have no long-lived shared-container network, so Silo warns and ignores configured host ports. Custom derivatives support host ports whenever they use the shared lifecycle.
Runtime boundary
Apple's container CLI owns Linux kernels, image storage, networking, VM execution, and low-level mount behavior. Silo owns only the resources carrying its validated labels and delegates commands through the CLI.
Image building is the exception where Silo intentionally uses Apple's user-global builder. silo image build force-deletes that builder, which can disrupt direct Apple Container workflows; silo image update leaves the builder in place. The exact lifecycle and scope are documented in image build and publication. Published-image cleanup, container operations, and managed-state operations remain ownership-scoped and conservative.