docker

package
v0.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory(cfg Config) (sandboxpkg.Factory, error)

NewFactory returns a Factory backed by a Docker container-per-session strategy.

When cfg.StellaHome is non-empty, construction performs I/O:

  • DooD detection: reads /.dockerenv, /run/.containerenv, and $STELLA_HOME_HOST to auto-derive path-translation prefixes. Fails if stella is inside a container but STELLA_HOME_HOST is not set.
  • User tool resolution: loads the builtin and user plugin manifests ($STELLA_HOME/plugins.yaml) to populate UserToolBinaries.

Both steps are skipped when StellaHome is empty (e.g. unit tests), making construction cheap and infallible in that case.

func Preflight

func Preflight(ctx context.Context, cfg PreflightConfig) error

Preflight checks daemon reachability and image availability. A missing image is pulled automatically; the caller is expected to have built or published the image ahead of time for dev builds (the pull will fail with a registry error in that case).

Types

type Config

type Config struct {
	// Image is the container image to use. Required.
	Image string

	// StellaHome is the host-view stella home directory. Used for orphan
	// cleanup scoping, preflight checks, DooD path translation, and
	// resolving user tool binaries from the plugins manifest.
	StellaHome string

	// ContainerPathPrefix / HostPathPrefix enable path alignment when stella
	// runs inside a container and talks to the daemon on the host (DooD).
	// Normally auto-derived from STELLA_HOME_HOST by NewFactory; only set
	// explicitly in tests or when overriding the default detection.
	ContainerPathPrefix string
	HostPathPrefix      string

	// UserToolBinaries are manifest-declared, user-configured CLIs that are not
	// baked into the versioned sandbox image. They are installed in a Linux
	// helper container and exposed to sessions through a Docker-managed tool
	// cache, never through host $STELLA_HOME/bin.
	// Normally auto-resolved by NewFactory from $STELLA_HOME/plugins.yaml.
	UserToolBinaries []ToolBinary
}

Config configures the docker sandbox factory.

func (Config) TranslateToDaemonPath

func (c Config) TranslateToDaemonPath(path string) string

TranslateToDaemonPath rewrites an stella-view absolute path into the path the daemon will use as a bind-mount source. When prefix translation is not configured, the input is returned unchanged.

type PreflightConfig

type PreflightConfig struct {
	StellaHome string
	Docker     Config
}

PreflightConfig configures a Preflight check.

type ToolBinary

type ToolBinary struct {
	Name    string
	Tool    string // mise tool key: uv, bun, github:owner/repo, pipx:pkg, npm:pkg, http:name
	Version string
	Options map[string]any // mise tool options, using the same names as mise.toml
}

ToolBinary describes a user-configured CLI that must be installed in a Linux container context before docker sandbox sessions can execute it. Fields mirror manifestplugins.ManifestBinary 1:1; keep them in sync.

Directories

Path Synopsis
Package dockerclient wraps the moby Go SDK (github.com/moby/moby/client) to manage sandbox containers for the docker sandbox backend.
Package dockerclient wraps the moby Go SDK (github.com/moby/moby/client) to manage sandbox containers for the docker sandbox backend.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL