Documentation
¶
Overview ¶
Package dockerexec is an example sandbox implementation that runs each exec-hook invocation inside an already-running container via `docker exec -i`. This is the cheap sibling of dockerrun: no per-call container startup cost, just a docker exec that pipes stdin/stdout through.
Typical use case: a long-lived sidecar container in the same Compose stack that has the hook scripts and their runtime dependencies baked in. A nearby example: `kubectlexec` for the Kubernetes equivalent.
This is reference/example code — not imported by PromptKit core. Register via sdk.WithSandboxFactory or sandbox.RegisterFactory, or construct one directly and set it on ExecHookConfig.Sandbox.
Configuration:
mode: docker_exec container: my-hooks-sidecar # required workdir: /app # optional; maps to --workdir user: hookuser # optional; maps to --user extra_args: [--tty] # optional
Index ¶
Constants ¶
const ModeName = "docker_exec"
ModeName is the identifier under which this backend registers with sandbox.RegisterFactory.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Container is the name or ID of the running container to exec into.
// Required.
Container string
// Workdir maps to `docker exec --workdir=<value>`. Empty means don't
// pass the flag.
Workdir string
// User maps to `docker exec --user=<value>`. Empty means don't pass
// the flag.
User string
// ExtraArgs are extra `docker exec` flags inserted after the
// standard ones and before the container name.
ExtraArgs []string
// DockerPath overrides the `docker` binary name. Empty uses `docker`
// resolved from PATH.
DockerPath string
}
Config configures the docker-exec backend.