docker

package
v0.0.0-...-34c65b8 Latest Latest
Warning

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

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

Documentation

Overview

Package docker builds a Docker SDK client and derives the host name used in the printed "opencode attach http://<host>:<port>" line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachHost

func AttachHost(dockerHost string) string

AttachHost derives the host portion of the attach URL from a Docker host URL.

tcp://1.2.3.4:2375       → 1.2.3.4
ssh://user@box.internal  → box.internal
unix:// / npipe:// / "" → 127.0.0.1

A wildcard (0.0.0.0, ::) collapses to 127.0.0.1 so the printed URL is actually dialable.

func EffectiveHost

func EffectiveHost(configHost string) string

EffectiveHost reports the Docker host string that the client will actually use, applying the same precedence as NewClient.

func IsRemoteHost

func IsRemoteHost(host string) bool

IsRemoteHost reports whether host refers to a remote Docker daemon (TCP, SSH, HTTP/HTTPS) rather than a local socket.

func NewClient

func NewClient(host string) (*client.Client, error)

NewClient builds a Docker client.

Host resolution order:

  1. host argument (from config docker.host or --docker-host flag)
  2. DOCKER_HOST environment variable
  3. active Docker CLI context (DOCKER_CONTEXT env or currentContext in ~/.docker/config.json)
  4. SDK default (platform socket)

Types

This section is empty.

Jump to

Keyboard shortcuts

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