Documentation
¶
Overview ¶
Package shared provides domain logic and shared options for container commands. Container option types live here alongside domain orchestration, avoiding the need for a separate opts/ package to break import cycles.
Index ¶
- func AddFlags(flags *pflag.FlagSet, opts *ContainerCreateOptions)
- func BootstrapServicesPostStart(ctx context.Context, container string, cmdOpts CommandOpts) error
- func BootstrapServicesPreStart(ctx context.Context, container string, cmdOpts CommandOpts) error
- func ContainerStart(ctx context.Context, cmdOpts CommandOpts, ...) (mobyClient.ContainerStartResult, error)
- func InitContainerConfig(ctx context.Context, opts InitConfigOpts) error
- func InjectPostInitScript(ctx context.Context, opts InjectPostInitOpts) error
- func InstallAgentBootstrapMaterial(ctx context.Context, caCertPath, caKeyPath string, ...) error
- func IsOutsideHome(dir string) bool
- func MarkMutuallyExclusive(cmd *cobra.Command)
- func MergeLabels(baseLabels, userLabels map[string]string) map[string]string
- func NeedsSocketBridge(cfg *config.Project) bool
- func ParseLabelsToMap(labels []string) map[string]string
- func RebuildMissingDefaultImage(ctx context.Context, opts RebuildMissingImageOpts) error
- func ResolveAgentEnv(agent config.AgentConfig, projectDir string, log *logger.Logger) (map[string]string, []string, error)
- func ResolveAgentName(agent string, generateRandom func() string) string
- func WriteAgentBootstrapToContainer(ctx context.Context, containerID string, copyFn CopyToContainerFn, ...) error
- type AgentBootstrap
- type CommandOpts
- type ContainerCreateOptions
- func (opts *ContainerCreateOptions) BuildConfigs(flags *pflag.FlagSet, mounts []mount.Mount, projectCfg *config.Project) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error)
- func (opts *ContainerCreateOptions) GetAgentName() string
- func (opts *ContainerCreateOptions) ValidateFlags() error
- type CopyFromContainerFn
- type CopyToContainerFn
- type CopyToVolumeFn
- type CreateContainerEvent
- type CreateContainerOptions
- type CreateContainerResult
- type InitConfigOpts
- type InjectPostInitOpts
- type InstallAgentBootstrapOptions
- type ListOpts
- type MapOpts
- type MessageType
- type NetworkAttachmentOpts
- type NetworkOpt
- type PortOpts
- type RebuildMissingImageOpts
- type StepStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddFlags ¶ added in v0.1.2
func AddFlags(flags *pflag.FlagSet, opts *ContainerCreateOptions)
AddFlags adds common container flags to the given flag set. This is the single point for flag registration shared between run and create commands.
func BootstrapServicesPostStart ¶ added in v0.5.0
func BootstrapServicesPostStart(ctx context.Context, container string, cmdOpts CommandOpts) error
func BootstrapServicesPreStart ¶ added in v0.5.0
func BootstrapServicesPreStart(ctx context.Context, container string, cmdOpts CommandOpts) error
func ContainerStart ¶ added in v0.5.0
func ContainerStart(ctx context.Context, cmdOpts CommandOpts, startOpts docker.ContainerStartOptions) (mobyClient.ContainerStartResult, error)
func InitContainerConfig ¶
func InitContainerConfig(ctx context.Context, opts InitConfigOpts) error
InitContainerConfig handles one-time claude config initialization for new containers. Called after EnsureConfigVolumes when the config volume was freshly created.
Steps:
- If strategy=="copy": prepare host claude config, copy to volume
- If use_host_auth: prepare credentials, copy to volume
func InjectPostInitScript ¶
func InjectPostInitScript(ctx context.Context, opts InjectPostInitOpts) error
InjectPostInitScript writes ~/.clawker/post-init.sh to a created (not started) container. Must be called after ContainerCreate and before ContainerStart. The entrypoint is responsible for running this script once on first start and creating a ~/.claude/post-initialized marker to prevent re-runs on restart.
func InstallAgentBootstrapMaterial ¶ added in v0.8.0
func InstallAgentBootstrapMaterial(ctx context.Context, caCertPath, caKeyPath string, signingKey *ecdsa.PrivateKey, opts InstallAgentBootstrapOptions) error
InstallAgentBootstrapMaterial is the create-time agent install: mint cert/key/CA/assertion (GenerateAgentBootstrap) and tar them into the container's writable layer at consts.BootstrapDir (WriteAgentBootstrapToContainer).
No DB I/O. The agentregistry row is written CP-side at Register handler entry, not from the CLI. A failure here is recovered by the caller's ContainerRemove without orphaning anything.
Returns error only — the bootstrap struct is consumed entirely by the tar copy step. Returning the struct previously suggested a downstream consumer that no longer exists (the registry-write path was retired); collapsing the signature removes that misleading hint.
func IsOutsideHome ¶ added in v0.3.2
IsOutsideHome reports whether dir is $HOME itself or not within $HOME. Returns false if $HOME cannot be determined or paths cannot be resolved.
func MarkMutuallyExclusive ¶ added in v0.1.2
MarkMutuallyExclusive marks agent and name flags as mutually exclusive on the command.
func MergeLabels ¶ added in v0.1.2
MergeLabels merges user-provided labels with base labels. Base labels take precedence (clawker labels should not be overwritten).
func NeedsSocketBridge ¶ added in v0.1.2
NeedsSocketBridge returns true if the project config enables GPG or SSH forwarding, which requires a socket bridge daemon.
func ParseLabelsToMap ¶ added in v0.1.2
ParseLabelsToMap converts a slice of "key=value" strings to a map. This is useful for merging user labels with clawker labels.
func RebuildMissingDefaultImage ¶
func RebuildMissingDefaultImage(ctx context.Context, opts RebuildMissingImageOpts) error
RebuildMissingDefaultImage prompts the user to rebuild a missing default image. In non-interactive mode, prints instructions and returns an error. In interactive mode, prompts for flavor selection and rebuilds with TUI progress.
func ResolveAgentEnv ¶ added in v0.2.0
func ResolveAgentEnv(agent config.AgentConfig, projectDir string, log *logger.Logger) (map[string]string, []string, error)
ResolveAgentEnv merges env_file, from_env, and env into a single map. Precedence (lowest to highest): env_file < from_env < env. The projectDir is used to resolve relative paths in env_file entries. Returns the merged env map, any warnings (e.g. unset from_env vars), and an error.
func ResolveAgentName ¶ added in v0.1.2
ResolveAgentName returns the agent name, generating one if not provided. This is a helper that commands can use for generating random names.
func WriteAgentBootstrapToContainer ¶ added in v0.8.0
func WriteAgentBootstrapToContainer(ctx context.Context, containerID string, copyFn CopyToContainerFn, b *AgentBootstrap) error
WriteAgentBootstrapToContainer streams the bootstrap material as a tar archive into the container's filesystem at consts.BootstrapDir. Files are 0400 root:root inside the archive; the directory itself is 0700 root:root. Caller passes the same CopyToContainerFn used by InjectPostInitScript, so behavior matches existing post-create injection patterns.
Note: the destination is currently a regular path inside the container's writable layer rather than a tmpfs mount. Docker's CopyToContainer cannot pre-populate tmpfs mounts (tmpfs is mounted at start time, shadowing any contents written via cp before start), so the pragmatic placement uses the writable layer with strict permissions. The container layer is destroyed on `--rm` or when the container is removed; for non-`--rm` containers the material stays in the writable layer until removal but is only useful against this container's identity.
Types ¶
type AgentBootstrap ¶ added in v0.8.0
AgentBootstrap is the per-agent registration package the CLI delivers to a managed container at boot. It collects the mTLS leaf cert and key, the CA cert clawkerd uses to trust the CP server, and the Hydra client_assertion JWT. Material is meant to be tarred directly to the container — never persisted on the host.
The String/GoString methods deliberately redact every field so the struct (which holds the per-agent private key and the Hydra client_assertion JWT) cannot leak via fmt verbs or zerolog's interface logger. Callers needing the raw fields must read them directly.
The cert thumbprint is intentionally NOT carried here. CP captures the thumbprint at Register handler entry from the live mTLS peer (cert.Raw → SHA-256). The CLI does not pre-stage a thumbprint attestation in the registry — that was the source of the cross-process WAL coherence bug this redesign fixes. The CLI's trust contribution is the cert minting itself (chained to CLI CA, container_id baked into the URI SAN); CP is the sole writer of agentregistry rows.
func GenerateAgentBootstrap ¶ added in v0.8.0
func GenerateAgentBootstrap(caCertPath, caKeyPath string, project auth.ProjectSlug, agent auth.AgentName, containerID, hydraTokenURL string, signingKey *ecdsa.PrivateKey) (*AgentBootstrap, error)
GenerateAgentBootstrap mints all material the CLI needs to start one agent: the per-agent mTLS leaf cert + key signed by the CLI CA (with containerID embedded as a URI SAN), the CP server-trust CA cert, and a Hydra client_assertion JWT for the clawker-agent OAuth2 client. caCertPath/caKeyPath identify the CLI CA on disk (typically `consts.AuthCACertPath()` / `consts.AuthCAKeyPath()`); hydraTokenURL is the audience of the assertion (the CP's Hydra `/oauth2/token` endpoint as clawkerd will see it from inside the container).
project + agent are the user-typed short identifiers (e.g. "myapp", "dev") — never the canonical "clawker.project.agent" form. The cert's CN is composed inside MintAgentCert via auth.CanonicalAgentCN so every CLI caller produces the same canonical shape and the agent handler's peer-cert CN cross-check has a single equality to enforce.
containerID is the docker container_id returned by ContainerCreate — MintAgentCert embeds it as a URI SAN so the CP-side Register handler can read the cert's binding to a specific container directly off the peer cert at handler entry.
The signature uses the typed auth.ProjectSlug / auth.AgentName so the caller has gone through NewProjectSlug / NewAgentName at the CLI flag boundary — a raw `string` cannot reach this function.
func (*AgentBootstrap) GoString ¶ added in v0.8.0
func (*AgentBootstrap) GoString() string
GoString redacts so fmt.Sprintf("%#v", b) (and any logger that uses Go-syntax representation) also does not leak KeyPEM or Assertion.
func (*AgentBootstrap) String ¶ added in v0.8.0
func (*AgentBootstrap) String() string
String redacts every field so AgentBootstrap can never accidentally leak the per-agent private key or the Hydra assertion JWT via fmt.Sprintf("%v", b) or zerolog.
type CommandOpts ¶ added in v0.5.0
type CommandOpts struct {
Client func(context.Context) (*docker.Client, error)
Config func() (config.Config, error)
ProjectManager func() (project.ProjectManager, error)
HostProxy func() hostproxy.HostProxyService
ControlPlane func() cpboot.Manager
AdminClient func(context.Context) (adminv1.AdminServiceClient, error)
SocketBridge func() socketbridge.SocketBridgeManager
Logger func() (*logger.Logger, error)
// AgentName is the user-typed short agent name (e.g. "dev", "test").
// NOT the canonical "clawker.project.agent" form — the canonical name
// is composed downstream (in MintAgentCert and as the registry row's
// canonical_cn column) from (Project, AgentName) so it has a single
// home. New-container start paths MUST set this; without it
// ContainerStart skips the bootstrap-delivery + registry-write and
// the entrypoint silently skips clawkerd launch. Existing-container
// start/restart paths leave it empty by design — those containers'
// registry rows already exist (the CP-side agent dialer picks up
// where it left off) or were intentionally never registered.
AgentName string
// Project is the clawker project slug the agent runs under, paired
// with AgentName to form the (project, agent) identity the CP keys
// agentregistry entries by. Empty string for the 2-segment unscoped
// naming case — same convention as docker.ContainerName. Must be set
// whenever AgentName is set on a new-container start path so
// MintAgentCert composes the right canonical CN.
Project string
}
type ContainerCreateOptions ¶ added in v0.5.0
type ContainerCreateOptions struct {
// Naming
Agent string // Agent name for clawker naming (clawker.<project>.<agent>)
Name string // Same as agent, for Docker CLI familiarity
// Container configuration
Env []string // Environment variables
EnvFile []string // Read env vars from file(s)
Volumes []string // Bind mounts
Publish *PortOpts
Workdir string // Working directory
User string // User
Entrypoint string // Override entrypoint
TTY bool // Allocate TTY
Stdin bool // Keep STDIN open
Attach *ListOpts // Attach to STDIN, STDOUT, STDERR
NetMode NetworkOpt // Network connection (supports advanced syntax)
Labels []string // Additional labels
LabelsFile []string // Read labels from file(s)
AutoRemove bool // Auto-remove on exit
Domainname string // Container NIS domain name
ContainerIDFile string // Write container ID to file
GroupAdd []string // Additional groups
// Resource limits
Memory docker.MemBytes // Memory limit (e.g., "512m", "2g")
MemorySwap docker.MemSwapBytes // Total memory (memory + swap), -1 for unlimited
MemoryReservation docker.MemBytes // Memory soft limit
ShmSize docker.MemBytes // Size of /dev/shm
CPUs docker.NanoCPUs // Number of CPUs (e.g., "1.5", "0.5")
CPUSetCPUs string // CPUs to allow (0-3, 0,1)
CPUSetMems string // MEMs to allow (0-3, 0,1)
CPUPeriod int64 // CFS period
CPUQuota int64 // CFS quota
CPURtPeriod int64 // Realtime period
CPURtRuntime int64 // Realtime runtime
BlkioWeight uint16 // Block IO weight (10-1000)
BlkioWeightDevice *docker.WeightDeviceOpt // Per-device block IO weight
DeviceReadBps *docker.ThrottleDeviceOpt // Read rate limit (bytes/sec)
DeviceWriteBps *docker.ThrottleDeviceOpt // Write rate limit (bytes/sec)
DeviceReadIOps *docker.ThrottleDeviceOpt // Read rate limit (IO/sec)
DeviceWriteIOps *docker.ThrottleDeviceOpt // Write rate limit (IO/sec)
PidsLimit int64 // Process limit (-1 unlimited)
OOMKillDisable bool // Disable OOM Killer
OOMScoreAdj int // OOM preferences (-1000 to 1000)
Swappiness int64 // Memory swappiness (0-100, -1 for default)
CPUCount int64 // CPU count (Windows only)
CPUPercent int64 // CPU percent (Windows only)
IOMaxBandwidth docker.MemBytes // Max IO bandwidth (Windows only)
IOMaxIOps uint64 // Max IOps (Windows only)
// Networking
Hostname string // Container hostname
DNS []string // Custom DNS servers
DNSSearch []string // Custom DNS search domains
DNSOptions []string // DNS options
ExtraHosts []string // Extra hosts (host:IP mapping)
Expose []string // Expose port(s) without publishing
PublishAll bool // Publish all exposed ports
MacAddress string // Container MAC address
IPv4Address string // IPv4 address
IPv6Address string // IPv6 address
Links []string // Add link to another container
Aliases []string // Network-scoped aliases
LinkLocalIPs []string // Link-local addresses
// Storage
Tmpfs []string // Tmpfs mounts (path or path:options)
ReadOnly bool // Mount root filesystem as read-only
VolumesFrom []string // Mount volumes from another container
VolumeDriver string // Volume driver
StorageOpt []string // Storage driver options
Mounts *docker.MountOpt // Advanced mount specifications
// Devices
Devices *docker.DeviceOpt // Host devices to add
GPUs *docker.GpuOpts // GPU devices
DeviceCgroupRules []string // Device cgroup rules
// Security
CapAdd []string // Add Linux capabilities
CapDrop []string // Drop Linux capabilities
Privileged bool // Give extended privileges to container
SecurityOpt []string // Security options (e.g., seccomp, apparmor, label)
DisableFirewall bool // DEPRECATED: no-op, use "clawker firewall bypass" instead
// Health check
HealthCmd string // Command to run to check health
HealthInterval time.Duration // Time between health checks
HealthTimeout time.Duration // Maximum time to allow health check to run
HealthRetries int // Consecutive failures needed to report unhealthy
HealthStartPeriod time.Duration // Start period for the container to initialize
HealthStartInterval time.Duration // Check interval during start period
NoHealthcheck bool // Disable any container-specified HEALTHCHECK
// Process and runtime
Restart string // Restart policy (no, always, on-failure[:max-retries], unless-stopped)
StopSignal string // Signal to stop the container (e.g., SIGTERM)
StopTimeout int // Timeout (in seconds) to stop a container
Init bool // Run init inside the container
// Namespace/Runtime
PidMode string // PID namespace
IpcMode string // IPC namespace
UtsMode string // UTS namespace
UsernsMode string // User namespace
CgroupnsMode string // Cgroup namespace
CgroupParent string // Parent cgroup
Runtime string // OCI runtime
Isolation string // Container isolation
// Logging
LogDriver string // Logging driver
LogOpts []string // Log driver options
// Resource limits (ulimits)
Ulimits *docker.UlimitOpt // Ulimit options
// Annotations and kernel parameters
Annotations *MapOpts // OCI annotations
Sysctls *MapOpts // Kernel parameters
// Workspace configuration
Mode string // "bind" or "snapshot" (empty = use config default)
Worktree string // Git worktree: "" (none), "branch", or "branch:base"
// Internal (set after parsing positional args)
Image string
Command []string
}
ContainerCreateOptions holds common options for container run and create commands. Commands can embed this struct and add command-specific options.
func NewContainerOptions ¶ added in v0.1.2
func NewContainerOptions() *ContainerCreateOptions
NewContainerOptions creates a new ContainerCreateOptions with initialized fields.
func (*ContainerCreateOptions) BuildConfigs ¶ added in v0.5.0
func (opts *ContainerCreateOptions) BuildConfigs(flags *pflag.FlagSet, mounts []mount.Mount, projectCfg *config.Project) (*container.Config, *container.HostConfig, *network.NetworkingConfig, error)
BuildConfigs builds Docker container, host, and network configs from the options. This consolidates the duplicated buildConfigs logic from run.go and create.go. The flags parameter is used to detect whether certain flags were explicitly set (e.g., --entrypoint="" to reset entrypoint, --stop-timeout, --init).
func (*ContainerCreateOptions) GetAgentName ¶ added in v0.5.0
func (opts *ContainerCreateOptions) GetAgentName() string
GetAgentName returns the agent name from either --agent or --name flag.
func (*ContainerCreateOptions) ValidateFlags ¶ added in v0.5.0
func (opts *ContainerCreateOptions) ValidateFlags() error
ValidateFlags performs cross-field validation on the options.
type CopyFromContainerFn ¶ added in v0.2.0
type CopyFromContainerFn func(ctx context.Context, containerID, srcPath string) (io.ReadCloser, error)
CopyFromContainerFn is the signature for reading a tar archive from a container. Returns a ReadCloser for the tar stream; caller must close it.
func NewCopyFromContainerFn ¶ added in v0.2.0
func NewCopyFromContainerFn(client *docker.Client) CopyFromContainerFn
NewCopyFromContainerFn creates a CopyFromContainerFn that delegates to the docker client.
type CopyToContainerFn ¶
type CopyToContainerFn func(ctx context.Context, containerID, destPath string, content io.Reader) error
CopyToContainerFn is the signature for copying a tar archive to a container. Wraps the lower-level Docker CopyToContainer API into a simpler interface.
func NewCopyToContainerFn ¶
func NewCopyToContainerFn(client *docker.Client) CopyToContainerFn
TODO: This is implemented wrong. constructors need to be added to accept factory *cmdutil.Factory, we don't pass indivdual deps) NewCopyToContainerFn creates a CopyToContainerFn that delegates to the docker client. This is the standard production wiring — use directly instead of writing an inline closure.
type CopyToVolumeFn ¶
type CopyToVolumeFn func(ctx context.Context, volumeName, srcDir, destPath string, ignorePatterns []string) error
CopyToVolumeFn is the signature for copying a directory to a Docker volume. Matches *docker.Client.CopyToVolume.
type CreateContainerEvent ¶ added in v0.1.2
type CreateContainerEvent struct {
Step string // "workspace", "config", "environment", "container"
Status StepStatus // Step lifecycle state
Message string // User-facing text
Type MessageType // Info or Warning
}
CreateContainerEvent is sent on the events channel during CreateContainer. Callers use these to drive spinners, collect warnings, etc.
type CreateContainerOptions ¶ added in v0.5.0
type CreateContainerOptions struct {
Client *docker.Client
Config config.Config
ProjectName string
Options *ContainerCreateOptions
Flags *pflag.FlagSet
Version string
ProjectManager func() (project.ProjectManager, error)
HostProxy func() hostproxy.HostProxyService
Log *logger.Logger
Is256Color bool
IsTrueColor bool
}
CreateContainerOptions holds all inputs for CreateContainer.
type CreateContainerResult ¶ added in v0.1.2
type CreateContainerResult struct {
ContainerID string
AgentName string
ContainerName string
WorkDir string
HostProxyRunning bool
}
CreateContainerResult holds the outputs of CreateContainer.
func CreateContainer ¶ added in v0.1.2
func CreateContainer(ctx context.Context, opts *CreateContainerOptions, events chan<- CreateContainerEvent) (_ *CreateContainerResult, retErr error)
CreateContainer is the single entry point for container creation, shared by run and create commands. It performs workspace setup, config initialization, environment resolution, Docker container creation, and post-create injection.
Progress is communicated via the events channel (nil for silent mode). Developer diagnostics go to zerolog. Callers own all terminal output.
Uses named return retErr so deferred volume cleanup can inspect the error.
type InitConfigOpts ¶
type InitConfigOpts struct {
// ProjectName is the project name for volume naming.
ProjectName string
// AgentName is the agent name for volume naming.
AgentName string
// ContainerWorkDir is the workspace directory inside the container (e.g. "/Users/dev/my-app").
// Used to rewrite projectPath values in installed_plugins.json.
ContainerWorkDir string
// ClaudeCode is the claude code configuration. Nil uses defaults (copy strategy + host auth).
ClaudeCode *config.ClaudeCodeConfig
// CopyToVolume copies a directory to a Docker volume.
// In production, wire this to (*docker.Client).CopyToVolume.
CopyToVolume CopyToVolumeFn
// Log is the logger for diagnostic file logging.
Log *logger.Logger
}
InitConfigOpts holds options for container init orchestration.
type InjectPostInitOpts ¶
type InjectPostInitOpts struct {
// ContainerID is the Docker container ID to inject the script into.
ContainerID string
// Script is the user's post_init content from .clawker.yaml.
Script string
// Cfg provides config constants for containerfs.
Cfg config.Config
// CopyToContainer copies a tar archive to the container at the given destination path.
// In production, wire this to a function that calls (*docker.Client).CopyToContainer.
CopyToContainer CopyToContainerFn
// Log is the logger for diagnostic file logging.
Log *logger.Logger
}
InjectPostInitOpts holds options for post-init script injection.
type InstallAgentBootstrapOptions ¶ added in v0.8.0
type InstallAgentBootstrapOptions struct {
// Project + Agent are the typed (project, agent_name) identity
// validated upstream at the CLI flag boundary. Used to compose the
// canonical CN in the leaf cert.
Project auth.ProjectSlug
Agent auth.AgentName
// ContainerID is the ID returned by client.ContainerCreate. Embedded
// as a URI SAN in the leaf cert and read by the CP-side Register
// handler at handler entry.
ContainerID string
// HydraTokenAudience is the `aud` claim in the Hydra
// client_assertion. Resolved by callers via
// hydraTokenAudienceFromPort(cfg.Settings().ControlPlane.HydraPublicPort).
HydraTokenAudience string
// CopyToContainer streams the bootstrap tar into ContainerID's
// writable layer at consts.BootstrapDir.
CopyToContainer CopyToContainerFn
// Logger receives a single info line on success. Required.
Logger *logger.Logger
}
InstallAgentBootstrapOptions bundles the inputs InstallAgentBootstrap needs at container CREATE time — fresh cert+key minted per container, CopyToContainered into the writable layer.
No registry path here. CP is the sole sqlite writer; the registry row is written server-side at Register handler entry, not from the CLI.
type ListOpts ¶ added in v0.1.2
type ListOpts struct {
// contains filtered or unexported fields
}
ListOpts holds a list of values for repeatable string flags (like -e VAR1 -e VAR2). Implements pflag.Value interface.
func NewListOpts ¶ added in v0.1.2
NewListOpts creates a new ListOpts with optional validator. If validator is nil, values are accepted as-is.
func NewListOptsRef ¶ added in v0.1.2
NewListOptsRef creates a new ListOpts that stores values in the provided slice. This is useful when you want to reuse an existing slice.
type MapOpts ¶ added in v0.1.2
type MapOpts struct {
// contains filtered or unexported fields
}
MapOpts holds key=value pairs for flags like --label or --env. Implements pflag.Value interface.
func NewMapOpts ¶ added in v0.1.2
NewMapOpts creates a new MapOpts with optional validator.
type MessageType ¶ added in v0.1.2
type MessageType int
MessageType classifies the severity of a step message.
const ( MessageInfo MessageType = iota // Informational substep update MessageWarning // Non-fatal issue )
type NetworkAttachmentOpts ¶ added in v0.1.2
type NetworkAttachmentOpts struct {
Target string
Aliases []string
DriverOpts map[string]string
Links []string
IPv4Address netip.Addr
IPv6Address netip.Addr
MacAddress string
LinkLocalIPs []netip.Addr
GwPriority int
}
NetworkAttachmentOpts holds options for a single network attachment. This mirrors Docker CLI's opts.NetworkAttachmentOpts.
type NetworkOpt ¶ added in v0.1.2
type NetworkOpt struct {
// contains filtered or unexported fields
}
NetworkOpt is a pflag.Value that supports advanced --network syntax. Simple usage: --network bridge Advanced usage: --network name=mynet,alias=web,driver-opt=foo=bar,ip=172.20.0.5,ip6=::1,mac-address=...,link-local-ip=...,gw-priority=100 Multiple networks: --network mynet1 --network mynet2
func (*NetworkOpt) NetworkMode ¶ added in v0.1.2
func (n *NetworkOpt) NetworkMode() string
NetworkMode returns the network mode string for use with HostConfig.NetworkMode. For the first network, this returns the target name. For empty networks, returns "".
func (*NetworkOpt) Set ¶ added in v0.1.2
func (n *NetworkOpt) Set(value string) error
Set parses a --network value. It supports both simple mode names (e.g., "bridge", "host", "mynet") and advanced key=value syntax (e.g., "name=mynet,alias=web,driver-opt=opt1=val1").
func (*NetworkOpt) String ¶ added in v0.1.2
func (n *NetworkOpt) String() string
String returns a string representation of the network option.
func (*NetworkOpt) Type ¶ added in v0.1.2
func (n *NetworkOpt) Type() string
Type returns the type name for pflag.
func (*NetworkOpt) Value ¶ added in v0.1.2
func (n *NetworkOpt) Value() []NetworkAttachmentOpts
Value returns the parsed network attachment options.
type PortOpts ¶ added in v0.1.2
type PortOpts struct {
// contains filtered or unexported fields
}
PortOpts holds port mappings for -p/--publish flags. Implements pflag.Value interface.
func (*PortOpts) GetAsStrings ¶ added in v0.1.2
GetAsStrings returns the port mappings as a slice of strings in "hostPort:containerPort" format. This is primarily useful for testing and comparison.
func (*PortOpts) GetExposedPorts ¶ added in v0.1.2
GetExposedPorts returns the exposed ports set for container config.
func (*PortOpts) GetPortBindings ¶ added in v0.1.2
GetPortBindings returns the port bindings for host config.
func (*PortOpts) Set ¶ added in v0.1.2
Set parses a port mapping spec (e.g., "8080:80", "127.0.0.1:8080:80/tcp") and adds it to the port mappings.
type RebuildMissingImageOpts ¶
type RebuildMissingImageOpts struct {
ImageRef string
IOStreams *iostreams.IOStreams
TUI *tui.TUI
Prompter func() *prompter.Prompter
BuildImage docker.BuildDefaultImageFn
CommandVerb string // "run" or "create" for error messages
}
RebuildMissingImageOpts holds options for the rebuild prompt flow.
type StepStatus ¶ added in v0.1.2
type StepStatus int
StepStatus represents the lifecycle state of a creation step.
const ( StepRunning StepStatus = iota // Step in progress StepComplete // Step finished successfully StepCached // Step skipped (already done) )