docker

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package docker wraps the Docker Engine API for container operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateServiceName

func ValidateServiceName(name string) error

ValidateServiceName checks that a service name conforms to Docker Compose naming rules.

Types

type Client

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

Client provides high-level container operations on top of the Docker SDK.

func NewClient

func NewClient() (*Client, error)

NewClient connects to the Docker daemon using environment configuration.

func (*Client) Close

func (c *Client) Close() error

Close releases the underlying Docker client connection.

func (*Client) ContainerIDByName

func (c *Client) ContainerIDByName(serviceName string) (string, error)

ContainerIDByName finds a running container by its compose service label.

func (*Client) ExecShell

func (c *Client) ExecShell(ctx context.Context, containerID string, in io.Reader, out io.Writer) error

ExecShell opens an interactive shell (bash or sh) inside the container.

func (*Client) Logs

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

Logs streams container logs to w, optionally following new output.

func (*Client) Raw

func (c *Client) Raw() *dockerclient.Client

Raw returns the underlying Docker SDK client for advanced operations.

func (*Client) Restart

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

Restart stops and restarts a container.

func (*Client) Status

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

Status returns the health or running state of a container.

func (*Client) TailLogs

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

TailLogs writes the last N lines of container logs to w.

Jump to

Keyboard shortcuts

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