Documentation
¶
Overview ¶
Package sdk provides a factory method for creating a Docker client.
Index ¶
Constants ¶
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
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 ¶
var ErrRuntimeNotFound = fmt.Errorf("container runtime not found")
ErrRuntimeNotFound is returned when a container runtime is not found
Functions ¶
func NewDockerClient ¶
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.