docker

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package docker wraps the Docker API client for devrig container lifecycle management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecReadyCheck

func ExecReadyCheck(ctx context.Context, cli *dockerclient.Client, containerID, command string, expect *string) error

ExecReadyCheck runs a command-based ready check via docker exec.

func RunReadyCheck

func RunReadyCheck(
	ctx context.Context,
	cli *dockerclient.Client,
	containerID string,
	check *config.ReadyCheck,
	hostPort *uint16,
	name string,
) error

RunReadyCheck polls until the container passes its ready check or the configured timeout expires.

func StreamContainerLogs

func StreamContainerLogs(ctx context.Context, cli *dockerclient.Client, containerID, serviceName string, b *events.Broadcaster)

StreamContainerLogs subscribes to container logs and broadcasts each line as a KindLogRecord event until ctx is cancelled or the stream ends.

Types

type Manager

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

Manager manages Docker containers and networks for a devrig project.

func New

func New(slug string) (*Manager, error)

New creates a Manager and verifies Docker daemon connectivity.

func (*Manager) CleanupAll

func (m *Manager) CleanupAll(ctx context.Context) error

CleanupAll removes all containers, volumes, and the network for this project.

func (*Manager) Client

func (m *Manager) Client() *dockerclient.Client

func (*Manager) ConnectContainerToNetwork

func (m *Manager) ConnectContainerToNetwork(ctx context.Context, containerID string, aliases []string) error

ConnectContainerToNetwork connects a container to the project network with aliases.

func (*Manager) DeleteService

func (m *Manager) DeleteService(ctx context.Context, st *state.DockerState) error

DeleteService stops and removes a container.

func (*Manager) EnsureNetwork

func (m *Manager) EnsureNetwork(ctx context.Context) error

EnsureNetwork creates the project bridge network if it doesn't already exist.

func (*Manager) NetworkName

func (m *Manager) NetworkName() string

func (*Manager) RemoveNetwork

func (m *Manager) RemoveNetwork(ctx context.Context) error

RemoveNetwork removes the project network (ignores not-found).

func (*Manager) Slug

func (m *Manager) Slug() string

func (*Manager) StartService

func (m *Manager) StartService(
	ctx context.Context,
	name string,
	cfg *config.DockerConfig,
	prevState *state.DockerState,
	allocated map[uint16]bool,
	configDir string,
) (state.DockerState, error)

StartService starts a single docker service container.

func (*Manager) StopService

func (m *Manager) StopService(ctx context.Context, st *state.DockerState) error

StopService stops a container (does not remove it).

Jump to

Keyboard shortcuts

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