docker

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the Docker SDK client with Ork-specific functionality

func NewClient

func NewClient() (*Client, error)

NewClient creates a new Docker client and verifies Docker is running

func (*Client) Close

func (c *Client) Close() error

Close releases resources used by the Docker client

func (*Client) ConnectContainer

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

ConnectContainer connects a container to the project network This must be called after the container is created but can be before or after it's started

func (*Client) CreateNetwork

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

CreateNetwork creates a Docker network for the project All containers in the same project will be connected to this network This allows services to communicate using service names (e.g., postgres:5432)

func (*Client) DeleteNetwork

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

DeleteNetwork removes a Docker network

func (*Client) GetNetworkID added in v0.2.0

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

GetNetworkID retrieves the network ID for a project Returns the network ID if it exists, empty string and error if not found

func (*Client) List

func (c *Client) List(ctx context.Context, projectName string) ([]ContainerInfo, error)

List returns a list of containers managed by Ork

func (*Client) Logs

func (c *Client) Logs(ctx context.Context, containerID string, opts LogsOptions) error

Logs retrieves and streams container logs to stdout This is useful for debugging and monitoring container output

func (*Client) Remove

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

Remove removes a Docker container (must be stopped first)

func (*Client) Run

func (c *Client) Run(ctx context.Context, opts RunOptions) (containerID string, err error)

Run creates and starts a Docker container This orchestrates the full container lifecycle but delegates to specialized functions

func (*Client) Stop

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

Stop stops a running Docker container

func (*Client) StopAndRemove

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

StopAndRemove stops and removes a Docker container

type ContainerInfo

type ContainerInfo struct {
	ID     string            // Container ID (short version)
	Name   string            // Container name
	Image  string            // Image name
	Status string            // Container status (e.g., "Up 5 minutes")
	Ports  []string          // Port mappings
	Labels map[string]string // Container labels
}

ContainerInfo represents information about a running container

type LogsOptions

type LogsOptions struct {
	Follow     bool                // Stream logs continuously (like tail -f)
	Tail       string              // Number of lines to show from the end ("all" or "100")
	Timestamps bool                // Show timestamps in log output
	Formatter  func(string) string // Optional: format each log line before output
}

LogsOptions contains configuration for retrieving container logs

type NetworkInfo

type NetworkInfo struct {
	ID   string // Network ID
	Name string // Network name
}

NetworkInfo represents information about a Docker network

type RunOptions

type RunOptions struct {
	Name       string            // Container name
	Image      string            // Docker image (e.g., "nginx:alpine")
	Ports      map[string]string // Port mappings (e.g., "8080": "80")
	Env        map[string]string // Environment variables
	Labels     map[string]string // Container labels
	Command    []string          // Override command
	Entrypoint []string          // Override entrypoint
}

RunOptions contains configuration for running a container

Jump to

Keyboard shortcuts

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