docker

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Overview

Package docker provides clawker-specific Docker middleware. It wraps pkg/whail with clawker's label conventions and naming schemes.

Package docker re-exports types from whail for use by commands. This allows commands to import internal/docker as their single Docker interface.

Index

Constants

View Source
const (
	// WaitConditionNotRunning is used to wait until a container is not running.
	WaitConditionNotRunning = whail.WaitConditionNotRunning
	WaitConditionNextExit   = whail.WaitConditionNextExit
	WaitConditionRemoved    = whail.WaitConditionRemoved
)
View Source
const DefaultImageTag = "clawker-default:latest"

DefaultImageTag is the tag used for the user's default base image.

View Source
const NamePrefix = "clawker"

NamePrefix is used for all clawker resource names.

Variables

This section is empty.

Functions

func BindOverlayDirsFromPatterns added in v0.1.9

func BindOverlayDirsFromPatterns(patterns []string) []string

BindOverlayDirsFromPatterns derives directory overlay targets from ignore patterns for bind mode. It intentionally only returns deterministic directory paths and skips file-glob patterns.

func BuildKitEnabled deprecated

func BuildKitEnabled(ctx context.Context, p Pinger) (bool, error)

BuildKitEnabled checks whether BuildKit is available.

Deprecated: Use whail.BuildKitEnabled directly.

func ContainerName

func ContainerName(project, agent string) (string, error)

ContainerName generates container name: clawker.project.agent Returns an error if project or agent names contain invalid characters.

func ContainerNamePrefix

func ContainerNamePrefix(project string) string

ContainerNamePrefix returns prefix for filtering: clawker.project.

func ContainerNamesFromAgents

func ContainerNamesFromAgents(project string, agents []string) ([]string, error)

ContainerNamesFromAgents resolves a slice of agent names to container names. If no agents are provided, returns the input slice unchanged. Returns an error if any agent or the project name is invalid.

func FindIgnoredDirs added in v0.1.9

func FindIgnoredDirs(log *logger.Logger, hostPath string, patterns []string) ([]string, error)

FindIgnoredDirs walks hostPath and returns relative paths of directories matching the given ignore patterns. Used by bind mode to generate tmpfs overlay mounts that mask ignored directories inside the container.

Key differences from snapshot's shouldIgnore:

  • Only returns directories (file patterns like *.log are not actionable)
  • Does NOT mask .git/ (bind mode needs git for live development)
  • Skips recursion into matched directories (performance)

func GenerateRandomName

func GenerateRandomName() string

GenerateRandomName generates a Docker-style random name (adjective-noun).

func GlobalVolumeName

func GlobalVolumeName(purpose string) string

GlobalVolumeName returns the name for a global (non-agent-scoped) volume. Example: GlobalVolumeName("globals") → "clawker-globals"

func ImageTag

func ImageTag(project string) string

ImageTag generates image tag: clawker-project:latest

func ImageTagWithHash

func ImageTagWithHash(project, hash string) string

ImageTagWithHash generates a content-addressed image tag: clawker-project:sha-<hash>

func LoadIgnorePatterns

func LoadIgnorePatterns(ignoreFile string) ([]string, error)

LoadIgnorePatterns reads patterns from an ignore file.

func ParseCPUs

func ParseCPUs(value string) (int64, error)

ParseCPUs takes a string ratio and returns an integer value of nano cpus

func ParseContainerName

func ParseContainerName(name string) (project, agent string, ok bool)

ParseContainerName extracts project and agent from container name. Container name format: clawker.project.agent Returns empty strings and false if the name doesn't match the format.

func RuntimeEnv

func RuntimeEnv(opts RuntimeEnvOpts) ([]string, error)

RuntimeEnv produces container environment variables from explicit options. Precedence (last wins): base defaults → terminal capabilities → agent env → instruction env. The result is sorted by key for deterministic ordering.

func TestLabelConfig

func TestLabelConfig(cfg config.Config, testName ...string) whail.LabelConfig

TestLabelConfig returns a LabelConfig that adds the test label to all resource types. Use with WithLabels in test code to ensure CleanupTestResources can find and remove test-created resources.

When testName is provided (typically t.Name()), the test name label is also set, enabling per-test resource debugging:

docker ps -a --filter label=dev.clawker.test.name=TestMyFunction
docker volume ls --filter label=dev.clawker.test.name=TestMyFunction

func ValidateResourceName added in v0.1.2

func ValidateResourceName(name string) error

ValidateResourceName validates that a name is suitable for use in Docker resource names. Matches Docker CLI's container name rules: [a-zA-Z0-9][a-zA-Z0-9_.-]* with a max length of 128.

func VolumeName

func VolumeName(project, agent, purpose string) (string, error)

VolumeName generates volume name: clawker.project.agent-purpose Returns an error if project or agent names contain invalid characters. The purpose parameter is not validated as it is always a hardcoded internal string.

func WireBuildKit

func WireBuildKit(c *Client)

WireBuildKit sets up the BuildKit image builder on the given Client. This encapsulates the buildkit subpackage dependency so callers don't need to import pkg/whail/buildkit directly.

Types

type BuildDefaultImageFn

type BuildDefaultImageFn func(ctx context.Context, flavor string, onProgress BuildProgressFunc) error

BuildDefaultImageFn is the function signature for building the default image. Matches (*Client).BuildDefaultImage. Used by shared/image.go for DI.

type BuildImageOpts

type BuildImageOpts struct {
	Tags            []string                // -t, --tag (multiple allowed)
	Dockerfile      string                  // -f, --file
	BuildArgs       map[string]*string      // --build-arg KEY=VALUE
	NoCache         bool                    // --no-cache
	Labels          map[string]string       // --label KEY=VALUE (merged with clawker labels)
	Target          string                  // --target
	Pull            bool                    // --pull (maps to PullParent)
	SuppressOutput  bool                    // -q, --quiet
	NetworkMode     string                  // --network
	BuildKitEnabled bool                    // Use BuildKit builder via whail.ImageBuildKit
	ContextDir      string                  // Build context directory (required for BuildKit)
	OnProgress      whail.BuildProgressFunc // Progress callback for build events
}

BuildImageOpts contains options for building an image.

type BuildProgressFunc

type BuildProgressFunc = whail.BuildProgressFunc

BuildProgressFunc is a callback for reporting build progress events.

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder handles Docker image building for clawker projects.

func NewBuilder

func NewBuilder(cli *Client, cfg *config.Project, workDir, projectName string) *Builder

NewBuilder creates a new Builder instance. projectName is the resolved project identity (from ProjectManager); empty string for unregistered projects. The builder inherits the logger from the Client.

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, imageTag string, opts BuilderOptions) error

Build unconditionally builds the Docker image.

func (*Builder) EnsureImage

func (b *Builder) EnsureImage(ctx context.Context, imageTag string, opts BuilderOptions) error

EnsureImage ensures an image is available, building if necessary. Uses content-addressed tags to detect whether config actually changed. If ForceBuild is true, rebuilds even if the image exists.

type BuilderOptions

type BuilderOptions struct {
	ForceBuild      bool                    // Force rebuild even if image exists
	NoCache         bool                    // Build without Docker cache
	Labels          map[string]string       // Labels to apply to the built image
	Target          string                  // Multi-stage build target
	Pull            bool                    // Always pull base image
	SuppressOutput  bool                    // Suppress build output
	NetworkMode     string                  // Network mode for build
	BuildArgs       map[string]*string      // Build-time variables
	Tags            []string                // Additional tags for the image (merged with imageTag)
	Dockerfile      []byte                  // Pre-rendered Dockerfile bytes (avoids re-generation)
	BuildKitEnabled bool                    // Use BuildKit builder for cache mount support
	OnProgress      whail.BuildProgressFunc // Progress callback for build events
}

BuilderOptions contains options for build operations.

type Client

type Client struct {
	*whail.Engine

	// BuildDefaultImageFunc overrides BuildDefaultImage when non-nil.
	// Used by fawker/tests to inject fake build behavior.
	// Follows the same pattern as whail.Engine.BuildKitImageBuilder.
	BuildDefaultImageFunc BuildDefaultImageFn

	// ChownImage overrides the image used for CopyToVolume's chown step.
	// When empty, defaults to "busybox:latest". Tests set this to a locally-built
	// labeled image to avoid DockerHub pulls and ensure test-label propagation.
	ChownImage string
	// contains filtered or unexported fields
}

Client embeds whail.Engine with clawker-specific label configuration. All whail.Engine methods are available directly on Client. Additional methods provide clawker-specific high-level operations.

func NewClient

func NewClient(ctx context.Context, cfg config.Config, log *logger.Logger, opts ...ClientOption) (*Client, error)

func NewClientFromEngine added in v0.2.0

func NewClientFromEngine(engine *whail.Engine, cfg config.Config, log *logger.Logger) *Client

NewClientFromEngine creates a Client from an existing Engine and config. Intended for testing — production code should use NewClient. When log is nil, a Nop logger is used.

func (*Client) AgentFilter added in v0.2.0

func (c *Client) AgentFilter(project, agent string) whail.Filters

AgentFilter returns Docker filter for a specific agent within a project.

func (*Client) BuildDefaultImage

func (c *Client) BuildDefaultImage(ctx context.Context, flavor string, onProgress whail.BuildProgressFunc) error

BuildDefaultImage builds the default clawker base image with the given flavor. It resolves the latest Claude Code version from npm, generates a Dockerfile, and builds the image with clawker's managed labels.

func (*Client) BuildImage

func (c *Client) BuildImage(ctx context.Context, buildContext io.Reader, opts BuildImageOpts) error

BuildImage builds a Docker image from a build context. When BuildKitEnabled and ContextDir are set, uses whail's BuildKit path (which supports --mount=type=cache). Otherwise falls back to the legacy Docker SDK ImageBuild API.

func (*Client) ClawkerFilter added in v0.2.0

func (c *Client) ClawkerFilter() whail.Filters

ClawkerFilter returns Docker filter for listing all clawker resources.

func (*Client) Close

func (c *Client) Close() error

Close closes the underlying Docker connection.

func (*Client) ContainerLabels added in v0.2.0

func (c *Client) ContainerLabels(project, agent, version, image, workdir string) map[string]string

ContainerLabels returns labels for a new container.

func (*Client) CopyToVolume

func (c *Client) CopyToVolume(ctx context.Context, volumeName, srcDir, destPath string, ignorePatterns []string) error

CopyToVolume copies a directory to a Docker volume using a temporary container.

func (*Client) EnsureVolume

func (c *Client) EnsureVolume(ctx context.Context, name string, labels map[string]string) (bool, error)

EnsureVolume creates a volume if it doesn't exist, returns true if created.

func (*Client) FindContainerByAgent

func (c *Client) FindContainerByAgent(ctx context.Context, project, agent string) (string, *container.Summary, error)

FindContainerByAgent finds a container by project and agent name. Returns the container name, container details, and any error. Returns (name, nil, nil) if container not found.

func (*Client) GlobalVolumeLabels added in v0.2.0

func (c *Client) GlobalVolumeLabels(purpose string) map[string]string

GlobalVolumeLabels returns labels for a global (non-agent-scoped) volume. Only includes managed and purpose labels — no project or agent.

func (*Client) ImageExists

func (c *Client) ImageExists(ctx context.Context, imageRef string) (bool, error)

ImageExists checks if a managed image exists locally. Returns true if the image exists and is managed, false if not found or unmanaged.

func (*Client) ImageLabels added in v0.2.0

func (c *Client) ImageLabels(project, version string) map[string]string

ImageLabels returns labels for a built image.

func (*Client) IsMonitoringActive

func (c *Client) IsMonitoringActive(ctx context.Context) bool

IsMonitoringActive checks if the clawker monitoring stack is running. It looks for the otel-collector container on the clawker-net network.

func (*Client) ListContainers

func (c *Client) ListContainers(ctx context.Context, includeAll bool) ([]Container, error)

ListContainers returns all clawker-managed containers.

func (*Client) ListContainersByProject

func (c *Client) ListContainersByProject(ctx context.Context, project string, includeAll bool) ([]Container, error)

ListContainersByProject returns containers for a specific project.

func (*Client) NetworkLabels added in v0.2.0

func (c *Client) NetworkLabels() map[string]string

NetworkLabels returns labels for a new network.

func (*Client) ProjectFilter added in v0.2.0

func (c *Client) ProjectFilter(project string) whail.Filters

ProjectFilter returns Docker filter for a specific project.

func (*Client) RemoveContainerWithVolumes

func (c *Client) RemoveContainerWithVolumes(ctx context.Context, containerID string, force bool) error

RemoveContainerWithVolumes removes a container and its associated volumes. If force is true, volume cleanup errors are logged but not returned. If force is false, volume cleanup errors are returned.

func (*Client) ResolveImage

func (c *Client) ResolveImage(ctx context.Context, projectName string) (string, error)

ResolveImage resolves the image reference to use. projectName is the resolved project identity (from ProjectManager); empty for unregistered projects. Returns empty string if no image could be resolved.

func (*Client) ResolveImageWithSource

func (c *Client) ResolveImageWithSource(ctx context.Context, projectName string) (*ResolvedImage, error)

ResolveImageWithSource resolves the image to use for container operations. projectName is the resolved project identity (from ProjectManager); empty for unregistered projects.

Resolution order:

  1. Docker label lookup — clawker-managed image matching project label with :latest tag
  2. Config fallback — merged build.image from all config layers (project, user, defaults)

Returns nil if no image could be resolved (caller decides what to do).

func (*Client) TagImage

func (c *Client) TagImage(ctx context.Context, source, target string) error

TagImage adds an additional tag to an existing managed image. source is the existing image reference, target is the new tag to apply.

func (*Client) VolumeLabels added in v0.2.0

func (c *Client) VolumeLabels(project, agent, purpose string) map[string]string

VolumeLabels returns labels for a new volume.

type ClientOption

type ClientOption func(*clientOptions)

ClientOption configures a NewClient call.

func WithLabels

func WithLabels(labels whail.LabelConfig) ClientOption

WithLabels injects additional labels into the whail engine. Use this to add test labels (e.g., dev.clawker.test=true) that propagate to all containers, volumes, and networks created by the client.

type Container

type Container struct {
	ID      string
	Name    string
	Project string
	Agent   string
	Image   string
	Workdir string
	Status  string
	Created int64
}

Container represents a clawker-managed container with parsed metadata.

type ContainerAttachOptions

type ContainerAttachOptions = whail.ContainerAttachOptions

Container operation options. ContainerCreateOptions is whail's custom struct with clawker-specific fields. SDKContainerCreateOptions is the raw Docker SDK type for direct API calls.

type ContainerCreateOptions

type ContainerCreateOptions = whail.ContainerCreateOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ContainerInspectOptions

type ContainerInspectOptions = whail.ContainerInspectOptions

Container result types

type ContainerInspectResult

type ContainerInspectResult = whail.ContainerInspectResult

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ContainerListOptions

type ContainerListOptions = whail.ContainerListOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ContainerLogsOptions

type ContainerLogsOptions = whail.ContainerLogsOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ContainerRemoveOptions

type ContainerRemoveOptions = whail.ContainerRemoveOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ContainerStartOptions

type ContainerStartOptions = whail.ContainerStartOptions

Whail-specific container types.

type ContainerUpdateResult

type ContainerUpdateResult = whail.ContainerUpdateResult

Container configuration types.

type ContainerWaitCondition

type ContainerWaitCondition = whail.WaitCondition

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type CopyFromContainerOptions

type CopyFromContainerOptions = whail.CopyFromContainerOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type CopyToContainerOptions

type CopyToContainerOptions = whail.CopyToContainerOptions

Copy operation options.

type DeviceOpt

type DeviceOpt struct {
	// contains filtered or unexported fields
}

DeviceOpt holds device mapping specifications. Implements pflag.Value interface.

func NewDeviceOpt

func NewDeviceOpt() *DeviceOpt

NewDeviceOpt creates a new DeviceOpt.

func (*DeviceOpt) GetAll

func (o *DeviceOpt) GetAll() []container.DeviceMapping

GetAll returns all device mappings.

func (*DeviceOpt) Len

func (o *DeviceOpt) Len() int

Len returns the number of device mappings.

func (*DeviceOpt) Set

func (o *DeviceOpt) Set(value string) error

Set parses a device specification in the format "host[:container[:permissions]]".

func (*DeviceOpt) String

func (o *DeviceOpt) String() string

String returns a string representation.

func (*DeviceOpt) Type

func (o *DeviceOpt) Type() string

Type returns the type string for pflag.

type DockerError

type DockerError = whail.DockerError

Error types.

type EnsureNetworkOptions

type EnsureNetworkOptions = whail.EnsureNetworkOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ExecAttachOptions

type ExecAttachOptions = whail.ExecAttachOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ExecCreateOptions

type ExecCreateOptions = whail.ExecCreateOptions

Exec operation options and results.

type ExecInspectOptions

type ExecInspectOptions = whail.ExecInspectOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ExecInspectResult

type ExecInspectResult = whail.ExecInspectResult

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ExecResizeOptions

type ExecResizeOptions = whail.ExecResizeOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ExecStartOptions

type ExecStartOptions = whail.ExecStartOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type Filters

type Filters = whail.Filters

Filters for filtering resources.

type GpuOpts

type GpuOpts struct {
	// contains filtered or unexported fields
}

GpuOpts holds GPU device request configuration. Implements pflag.Value interface.

func NewGpuOpts

func NewGpuOpts() *GpuOpts

NewGpuOpts creates a new GpuOpts.

func (*GpuOpts) GetAll

func (o *GpuOpts) GetAll() []container.DeviceRequest

GetAll returns all device requests.

func (*GpuOpts) Len

func (o *GpuOpts) Len() int

Len returns the number of GPU requests.

func (*GpuOpts) Set

func (o *GpuOpts) Set(value string) error

Set parses a GPU specification. Accepted formats:

  • "all" - request all GPUs
  • "N" (integer) - request N GPUs
  • "device=ID[,ID...]" - request specific device IDs
  • "driver=NAME,count=N,capabilities=CAP[,CAP...]" - full specification

func (*GpuOpts) String

func (o *GpuOpts) String() string

String returns a string representation.

func (*GpuOpts) Type

func (o *GpuOpts) Type() string

Type returns the type string for pflag.

type HijackedResponse

type HijackedResponse = whail.HijackedResponse

Connection types.

type ImageBuildOptions

type ImageBuildOptions = whail.ImageBuildOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ImageListOptions

type ImageListOptions = whail.ImageListOptions

Image operation options.

type ImageListResult

type ImageListResult = whail.ImageListResult

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ImagePullOptions

type ImagePullOptions = whail.ImagePullOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ImageRemoveOptions

type ImageRemoveOptions = whail.ImageRemoveOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ImageSource

type ImageSource string

ImageSource indicates where an image reference was resolved from.

const (
	ImageSourceExplicit ImageSource = "explicit" // User specified via CLI or args
	ImageSourceProject  ImageSource = "project"  // Found via project label search
	ImageSourceConfig   ImageSource = "config"   // From merged config (build.image)
)

type ImageSummary

type ImageSummary = whail.ImageSummary

Image result types.

type Labels

type Labels = whail.Labels

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type MemBytes

type MemBytes int64

MemBytes is a type for human readable memory bytes (like 128M, 2g, etc)

func (*MemBytes) Set

func (m *MemBytes) Set(value string) error

Set sets the value of the MemBytes by passing a string

func (*MemBytes) String

func (m *MemBytes) String() string

String returns the string format of the human readable memory bytes

func (*MemBytes) Type

func (*MemBytes) Type() string

Type returns the type

func (*MemBytes) UnmarshalJSON

func (m *MemBytes) UnmarshalJSON(s []byte) error

UnmarshalJSON is the customized unmarshaler for MemBytes

func (*MemBytes) Value

func (m *MemBytes) Value() int64

Value returns the value in int64

type MemSwapBytes

type MemSwapBytes int64

MemSwapBytes is a type for human readable memory bytes (like 128M, 2g, etc). It differs from MemBytes in that -1 is valid and the default.

func (*MemSwapBytes) Set

func (m *MemSwapBytes) Set(value string) error

Set sets the value of the MemSwapBytes by passing a string

func (*MemSwapBytes) String

func (m *MemSwapBytes) String() string

func (*MemSwapBytes) Type

func (*MemSwapBytes) Type() string

Type returns the type

func (*MemSwapBytes) UnmarshalJSON

func (m *MemSwapBytes) UnmarshalJSON(s []byte) error

UnmarshalJSON is the customized unmarshaler for MemSwapBytes

func (*MemSwapBytes) Value

func (m *MemSwapBytes) Value() int64

Value returns the value in int64

type MountOpt

type MountOpt struct {
	// contains filtered or unexported fields
}

MountOpt holds mount specifications. Implements pflag.Value interface.

func NewMountOpt

func NewMountOpt() *MountOpt

NewMountOpt creates a new MountOpt.

func (*MountOpt) GetAll

func (o *MountOpt) GetAll() []mount.Mount

GetAll returns all mount specifications.

func (*MountOpt) Len

func (o *MountOpt) Len() int

Len returns the number of mount specifications.

func (*MountOpt) Set

func (o *MountOpt) Set(value string) error

Set parses a mount specification in the format "type=X,source=Y,target=Z[,option=value...]".

func (*MountOpt) String

func (o *MountOpt) String() string

String returns a string representation.

func (*MountOpt) Type

func (o *MountOpt) Type() string

Type returns the type string for pflag.

type NanoCPUs

type NanoCPUs int64

NanoCPUs is a type for fixed point fractional number.

func (*NanoCPUs) Set

func (c *NanoCPUs) Set(value string) error

Set sets the value of the NanoCPU by passing a string

func (*NanoCPUs) String

func (c *NanoCPUs) String() string

String returns the string format of the number

func (*NanoCPUs) Type

func (*NanoCPUs) Type() string

Type returns the type

func (*NanoCPUs) Value

func (c *NanoCPUs) Value() int64

Value returns the value in int64

type NetworkCreateOptions

type NetworkCreateOptions = whail.NetworkCreateOptions

Network operation options.

type NetworkInspectOptions

type NetworkInspectOptions = whail.NetworkInspectOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type PTYHandler

type PTYHandler struct {
	// contains filtered or unexported fields
}

PTYHandler manages the pseudo-terminal connection to a container

func NewPTYHandler

func NewPTYHandler(log *logger.Logger) *PTYHandler

NewPTYHandler creates a new PTY handler. When log is nil, a Nop logger is used.

func (*PTYHandler) GetSize

func (p *PTYHandler) GetSize() (width, height int, err error)

GetSize returns the current terminal size

func (*PTYHandler) IsTerminal

func (p *PTYHandler) IsTerminal() bool

IsTerminal returns true if stdin is a terminal

func (*PTYHandler) Restore

func (p *PTYHandler) Restore() error

Restore returns the terminal to its original state. It first resets the terminal visual state (alternate screen, cursor visibility, text attributes) before restoring termios settings.

func (*PTYHandler) Setup

func (p *PTYHandler) Setup() error

Setup prepares the terminal for PTY interaction

func (*PTYHandler) Stream

func (p *PTYHandler) Stream(ctx context.Context, hijacked HijackedResponse) error

Stream handles bidirectional I/O between local terminal and container

func (*PTYHandler) StreamWithResize

func (p *PTYHandler) StreamWithResize(
	ctx context.Context,
	hijacked HijackedResponse,
	resizeFunc func(height, width uint) error,
) error

StreamWithResize handles bidirectional I/O with terminal resize support

type Pinger deprecated

type Pinger = whail.Pinger

Pinger is the subset of the Docker API needed for BuildKit detection.

Deprecated: Use whail.Pinger directly.

type ResolvedImage

type ResolvedImage struct {
	Reference string      // The image reference (name:tag)
	Source    ImageSource // Where the image was resolved from
}

ResolvedImage contains the result of image resolution with source tracking.

type Resources

type Resources = whail.Resources

Container configuration types.

type RestartPolicy

type RestartPolicy = whail.RestartPolicy

Container configuration types.

type RuntimeEnvOpts

type RuntimeEnvOpts struct {
	// Clawker identity (consumed by statusline)
	Version         string
	Project         string
	Agent           string
	WorkspaceMode   string // "bind" or "snapshot"
	WorkspaceSource string // host path being mounted

	// Editor preferences
	Editor string
	Visual string

	// Firewall
	FirewallEnabled        bool
	FirewallDomains        []string
	FirewallIPRangeSources []config.IPRangeSource

	// Monitoring stack
	MonitoringActive bool // Whether the monitoring stack (otel-collector) is running

	// Socket forwarding (consumed by socket-forwarder in container)
	GPGForwardingEnabled bool // Enable GPG agent forwarding
	SSHForwardingEnabled bool // Enable SSH agent forwarding

	// Terminal capabilities (from host)
	Is256Color bool
	TrueColor  bool

	// User-defined overrides (arbitrary pass-through)
	AgentEnv       map[string]string
	InstructionEnv map[string]string
}

RuntimeEnvOpts describes the environment variables RuntimeEnv can produce. Each field maps to a specific env var or category of env vars.

type SDKContainerCreateOptions

type SDKContainerCreateOptions = whail.SDKContainerCreateOptions

Type aliases re-exported from whail. Commands should use these types rather than importing whail directly.

type ThrottleDeviceOpt

type ThrottleDeviceOpt struct {
	// contains filtered or unexported fields
}

ThrottleDeviceOpt holds block IO throttle device settings. Implements pflag.Value interface.

func NewThrottleDeviceOpt

func NewThrottleDeviceOpt(isBytes bool) *ThrottleDeviceOpt

NewThrottleDeviceOpt creates a new ThrottleDeviceOpt. Set isBytes to true for byte rate limits, false for IO rate limits.

func (*ThrottleDeviceOpt) GetAll

func (o *ThrottleDeviceOpt) GetAll() []*blkiodev.ThrottleDevice

GetAll returns all throttle devices.

func (*ThrottleDeviceOpt) Len

func (o *ThrottleDeviceOpt) Len() int

Len returns the number of throttle devices.

func (*ThrottleDeviceOpt) Set

func (o *ThrottleDeviceOpt) Set(value string) error

Set parses a throttle device value in the format "device:rate". For byte rates, human-readable sizes are accepted (e.g., "1mb"). For IO rates, only numeric values are accepted.

func (*ThrottleDeviceOpt) String

func (o *ThrottleDeviceOpt) String() string

String returns a string representation.

func (*ThrottleDeviceOpt) Type

func (o *ThrottleDeviceOpt) Type() string

Type returns the type string for pflag.

type UlimitOpt

type UlimitOpt struct {
	// contains filtered or unexported fields
}

UlimitOpt holds a list of ulimits parsed from --ulimit flags. Implements pflag.Value interface.

func NewUlimitOpt

func NewUlimitOpt() *UlimitOpt

NewUlimitOpt creates a new UlimitOpt.

func (*UlimitOpt) GetAll

func (o *UlimitOpt) GetAll() []*container.Ulimit

GetAll returns all ulimits.

func (*UlimitOpt) Len

func (o *UlimitOpt) Len() int

Len returns the number of ulimits.

func (*UlimitOpt) Set

func (o *UlimitOpt) Set(value string) error

Set parses a ulimit value in the format "name=soft:hard" or "name=value".

func (*UlimitOpt) String

func (o *UlimitOpt) String() string

String returns a string representation.

func (*UlimitOpt) Type

func (o *UlimitOpt) Type() string

Type returns the type string for pflag.

type UpdateConfig

type UpdateConfig = whail.UpdateConfig

Container configuration types.

type VolumeCreateOptions

type VolumeCreateOptions = whail.VolumeCreateOptions

Volume operation options.

type WeightDeviceOpt

type WeightDeviceOpt struct {
	// contains filtered or unexported fields
}

WeightDeviceOpt holds block IO weight device settings. Implements pflag.Value interface.

func NewWeightDeviceOpt

func NewWeightDeviceOpt() *WeightDeviceOpt

NewWeightDeviceOpt creates a new WeightDeviceOpt.

func (*WeightDeviceOpt) GetAll

func (o *WeightDeviceOpt) GetAll() []*blkiodev.WeightDevice

GetAll returns all weight devices.

func (*WeightDeviceOpt) Len

func (o *WeightDeviceOpt) Len() int

Len returns the number of weight devices.

func (*WeightDeviceOpt) Set

func (o *WeightDeviceOpt) Set(value string) error

Set parses a weight device value in the format "device:weight".

func (*WeightDeviceOpt) String

func (o *WeightDeviceOpt) String() string

String returns a string representation.

func (*WeightDeviceOpt) Type

func (o *WeightDeviceOpt) Type() string

Type returns the type string for pflag.

Directories

Path Synopsis
Package dockertest provides test doubles for internal/docker.Client.
Package dockertest provides test doubles for internal/docker.Client.

Jump to

Keyboard shortcuts

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