Documentation
¶
Overview ¶
Package container provides Docker container lifecycle management for hawk's sandboxed execution environments. It wraps the Docker CLI to start, stop, inspect, and rebuild containers.
Index ¶
Constants ¶
const ( CodeNotFound = "not_found" CodeNotRunning = "not_running" CodeExecFailed = "exec_failed" CodeTimeout = "timeout" )
Error codes returned by ContainerError.
const ( StateRunning = "running" StateStopped = "exited" StateNotFound = "not_found" )
State constants returned by Status.
Variables ¶
This section is empty.
Functions ¶
func EnsureRunning ¶
EnsureRunning guarantees that the specified container is in a running state. If the container is stopped, it starts it. If it does not exist, it creates a new one from the given image with the working directory mounted. Returns the container ID (which may differ from input if recreated).
Types ¶
type ContainerError ¶
ContainerError is a typed error with a machine-readable Code field.
func (*ContainerError) Error ¶
func (e *ContainerError) Error() string
type ExecResult ¶
ExecResult holds the output of a command executed in a container.
func ExecWithStdin ¶
func ExecWithStdin(ctx context.Context, containerID string, cmd []string, stdin []byte) (*ExecResult, error)
ExecWithStdin runs a command inside a container with stdin piped from the provided byte slice. Arguments are passed directly to docker exec without shell wrapping, making it safe for structured input (e.g. JSON).