sdk

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package sdk provides a factory method for creating a Docker client.

Index

Constants

View Source
const (
	// DockerSocketEnv is the environment variable for custom Docker socket path
	DockerSocketEnv = "TOOLHIVE_DOCKER_SOCKET"
	// PodmanSocketEnv is the environment variable for custom Podman socket path
	PodmanSocketEnv = "TOOLHIVE_PODMAN_SOCKET"
	// ColimaSocketEnv is the environment variable for custom Colima socket path
	ColimaSocketEnv = "TOOLHIVE_COLIMA_SOCKET"
)

Environment variable names

View Source
const (
	// PodmanSocketPath is the default Podman socket path
	PodmanSocketPath = "/var/run/podman/podman.sock"
	// PodmanXDGRuntimeSocketPath is the XDG runtime Podman socket path
	PodmanXDGRuntimeSocketPath = "podman/podman.sock"
	// DockerSocketPath is the default Docker socket path
	DockerSocketPath = "/var/run/docker.sock"
	// DockerDesktopMacSocketPath is the Docker Desktop socket path on macOS
	DockerDesktopMacSocketPath = ".docker/run/docker.sock"
	// DockerDesktopLinuxSocketPath is the Docker Desktop socket path on Linux
	// (relative to $HOME). Docker Desktop on Linux registers a "desktop-linux"
	// Docker context that points to this socket.
	DockerDesktopLinuxSocketPath = ".docker/desktop/docker.sock"
	// RancherDesktopMacSocketPath is the Docker socket path for Rancher Desktop on macOS
	RancherDesktopMacSocketPath = ".rd/docker.sock"
	// OrbStackMacSocketPath is the Docker socket path for OrbStack on macOS
	OrbStackMacSocketPath = ".orbstack/run/docker.sock"
	// ColimaDesktopMacSocketPath is the Docker socket path for Colima on macOS
	ColimaDesktopMacSocketPath = ".colima/default/docker.sock"
)

Common socket paths

Variables

View Source
var ErrRuntimeNotFound = fmt.Errorf("container runtime not found")

ErrRuntimeNotFound is returned when a container runtime is not found

Functions

func NewDockerClient

func NewDockerClient(ctx context.Context) (*client.Client, string, runtime.Type, error)

NewDockerClient creates a new container client.

For each runtime (Podman, Docker, Colima) it asks the platform helper for every candidate socket that exists on disk and then tries to connect to each in turn. This matters in mixed setups — e.g. /var/run/docker.sock is present but the running user is not in the docker group, while Docker Desktop's per-user socket at ~/.docker/desktop/docker.sock would work. Without per-runtime fallback the first stat-OK socket short-circuits discovery and we'd surface "no container runtime available" even though a usable Docker daemon is reachable through a different socket.

Types

This section is empty.

Jump to

Keyboard shortcuts

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