docker

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package docker provides Docker client wrappers and container orchestration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOverlayImage

func BuildOverlayImage(ctx context.Context, base string, ws workspace.Resolved) (string, error)

func FormatBytes added in v1.12.0

func FormatBytes(b uint64) string

FormatBytes formats a byte count into a human-readable string (e.g. "1.5 GiB").

func FormatUptime added in v1.12.0

func FormatUptime(d time.Duration) string

FormatUptime formats a duration into a human-readable uptime string.

func ResolveBaseImage

func ResolveBaseImage(ctx context.Context, cfg *config.Config, version string) (string, error)

func RunningWorkspacePorts added in v1.10.0

func RunningWorkspacePorts(ctx context.Context) (map[string]int, error)

RunningWorkspacePorts returns a map of workspace name → published host port for all running jailoc opencode containers.

Types

type Client

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

func NewClient

func NewClient(composeFile, workDir, workspace string) *Client

func (*Client) ContainerState added in v1.7.0

func (c *Client) ContainerState(ctx context.Context) (state string, exitCode int, err error)

ContainerState returns the state and exit code of the opencode container, regardless of whether it is running. Returns empty state if no container exists.

func (*Client) ContainerStats added in v1.12.0

func (c *Client) ContainerStats(ctx context.Context) (ContainerStats, error)

ContainerStats fetches a one-shot stats snapshot for the opencode container.

func (*Client) CurrentContainerID

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

func (*Client) Down

func (c *Client) Down(ctx context.Context) error

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, args []string, env []string, stdin io.Reader, stdout, stderr io.Writer) error

func (*Client) HealthStatus added in v1.7.0

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

func (*Client) IsRunning

func (c *Client) IsRunning(ctx context.Context) (bool, error)

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, follow bool, w io.Writer) error

func (*Client) TailLogs added in v1.7.0

func (c *Client) TailLogs(ctx context.Context, n int, w io.Writer) error

func (*Client) Up

func (c *Client) Up(ctx context.Context) error

type ContainerStats added in v1.12.0

type ContainerStats struct {
	CPUPercent  float64
	CPULimit    float64 // CPU core limit (0 = unlimited)
	MemUsage    uint64
	MemLimit    uint64
	MemPercent  float64
	PIDsCurrent uint64
	PIDsLimit   uint64
	NetRx       uint64
	NetTx       uint64
	BlockRead   uint64
	BlockWrite  uint64
	Uptime      time.Duration
}

ContainerStats holds parsed resource consumption metrics for a container.

Jump to

Keyboard shortcuts

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