docker

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectPGVersionFromImage

func DetectPGVersionFromImage(imageName string) (string, bool)

DetectPGVersionFromImage tries to parse the PostgreSQL major version from an image name. Handles:

"postgres:17"                    → "17"
"postgres:17.2"                  → "17"
"pgvector/pgvector:pg18-trixie"  → "18"
"pgvector/pgvector:0.8.2-pg18"   → "18"
"postgis/postgis:18-3.6"         → "18"

Returns major version string and whether detection succeeded.

Types

type Client

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

func NewClient

func NewClient() (*Client, error)

func (*Client) CheckImageExists

func (c *Client) CheckImageExists(imageName string) ([]string, bool)

CheckImageExists checks if a Docker image exists locally and returns its tags

func (*Client) CreateContainer

func (c *Client) CreateContainer(name, version, image string, port int, password string, cpuCores, ramMB int, parameterGroupName string, parameterGroupParams []parameters.Parameter) (string, error)

func (*Client) GetContainerLogs

func (c *Client) GetContainerLogs(containerID, tail string) (string, error)

GetContainerLogs returns the last N lines of logs from a container. Both stdout and stderr are merged into a single string.

func (*Client) GetContainerStatus

func (c *Client) GetContainerStatus(containerID string) (string, error)

func (*Client) GetDockerClient

func (c *Client) GetDockerClient() *client.Client

GetDockerClient returns the underlying Docker client for advanced operations

func (*Client) PullImage

func (c *Client) PullImage(imageName string) error

PullImage pulls a Docker image from the registry

func (*Client) RecreateContainer

func (c *Client) RecreateContainer(name, version, image string, port int, password string, cpuCores, ramMB int, parameterGroupName string, parameterGroupParams []parameters.Parameter, oldContainerID string) (string, error)

RecreateContainer stops and removes the old container, then creates a new one with the same volume but new parameters

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(containerID string) error

func (*Client) RemoveHelperContainers

func (c *Client) RemoveHelperContainers() (int, error)

RemoveHelperContainers force-removes any containers labeled as ODDK helpers (label oddk.helper=true). Called at daemon startup to clean up orphans left by a previous crashed daemon run. Returns the number of containers removed.

Single-host single-daemon deployment is assumed. If a second ODDK daemon is running on the same host, this will rip out its in-flight helper containers.

func (*Client) RemoveVolume

func (c *Client) RemoveVolume(volumeName string) error

func (*Client) StartContainer

func (c *Client) StartContainer(containerID string) error

func (*Client) StopContainer

func (c *Client) StopContainer(containerID string) error

func (*Client) StreamContainerLogs

func (c *Client) StreamContainerLogs(ctx context.Context, containerID, tail string, w io.Writer) error

StreamContainerLogs streams container logs to w until ctx is cancelled or the container stops.

Jump to

Keyboard shortcuts

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