Documentation
¶
Overview ¶
Package dockerprovider implements the honey Docker Engine search backend.
Search modes (YAML mode or --docker-mode): containers, swarm, or both. Results are hosts.Record rows with provider "docker" and meta.kind container or swarm_task.
Daemon connections:
- Local or DOCKER_HOST (unix://, tcp://, https:// with optional TLS paths in config)
- Moby ssh:// (Engine SDK SSH; no Honey ~/.ssh/config integration)
- Honey SSH: via_local / via_ssh + socket + optional run_as (sudo -n -u … + docker system dial-stdio over an sshclient session; reuses TUI SSH when cached)
Auto-discover registers with searchrun.RegisterDockerDiscover. When HONEY_FEATURE_DOCKER_VIA_PROVIDERS=1 and --docker-discover-providers are set, searchrun runs a second pass over VM records from the already-filtered search (respecting --backends and --provider) and merges container rows.
Execution (terminals, parallel e, web exec, file browser) is wired through hostexec.SetDockerExecutor in internal/ui; the Moby client is github.com/moby/moby/client (API types in github.com/moby/moby/api).
Index ¶
- func ContainerIDFromRecord(containerID string) (string, error)
- func DefaultSocket(platform string) string
- func DialSSH(hop SSHHop, defaultUser string) (*ssh.Client, func(), error)
- func DiscoverOnVMs(ctx context.Context, q hosts.Query, vms []hosts.Record) ([]hosts.Record, error)
- func FeatureDockerViaProviders() bool
- func ListOptionsForBackend(all bool) client.ContainerListOptions
- func NewAPIClient(ctx context.Context, b BackendConfig, opts APIClientOptions) (*client.Client, error)
- func NewAPIClientFromRuntime(ctx context.Context, rt hostexec.DockerBackendRuntime, opts APIClientOptions) (*client.Client, error)
- func NormalizeMode(mode string) string
- func NormalizePlatform(p string) string
- func RecordMetaBase(bc BackendConfig, hop SSHHop, discover bool) map[string]string
- func ResolveSocket(socket, platform string) string
- func RunAsProxyCommandForTest(runAs, socketPath string) string
- type APIClientOptions
- type BackendConfig
- type DialParams
- type DiscoverOpts
- type Docker
- type SSHHop
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerIDFromRecord ¶
ContainerIDFromRecord returns the target container ID for exec/file ops.
func DefaultSocket ¶
DefaultSocket returns the default Engine socket path/URI for a platform.
func DiscoverOnVMs ¶
DiscoverOnVMs lists Docker containers on cloud VM records from an earlier search pass. VMs are already scoped by --backends / --provider filters on the parent search.
func FeatureDockerViaProviders ¶
func FeatureDockerViaProviders() bool
FeatureDockerViaProviders reports whether auto-discover on cloud VMs is enabled.
func ListOptionsForBackend ¶
func ListOptionsForBackend(all bool) client.ContainerListOptions
ListOptionsForBackend returns container list options for search.
func NewAPIClient ¶
func NewAPIClient(ctx context.Context, b BackendConfig, opts APIClientOptions) (*client.Client, error)
NewAPIClient builds a Moby client for the given backend settings.
func NewAPIClientFromRuntime ¶
func NewAPIClientFromRuntime(ctx context.Context, rt hostexec.DockerBackendRuntime, opts APIClientOptions) (*client.Client, error)
NewAPIClientFromRuntime builds a client from hostexec runtime config.
func NormalizeMode ¶
NormalizeMode returns containers, swarm, or both.
func NormalizePlatform ¶
NormalizePlatform returns linux or windows.
func RecordMetaBase ¶
func RecordMetaBase(bc BackendConfig, hop SSHHop, discover bool) map[string]string
RecordMetaBase returns common docker record meta for a backend connection.
func ResolveSocket ¶
ResolveSocket returns configured socket or platform default.
func RunAsProxyCommandForTest ¶
RunAsProxyCommandForTest returns the remote command used for run_as dial (tests).
Types ¶
type APIClientOptions ¶
type APIClientOptions struct {
SSHUser string
BorrowedSSH *ssh.Client
OwnsSSH bool // if true, close SSH on client close
VMRecord *hosts.Record
DiscoverOpts *DiscoverOpts
}
APIClientOptions optional SSH borrow and user for honey-ssh transport.
type BackendConfig ¶
type BackendConfig struct {
Name string
Host string
ViaLocal string
ViaSSH config.DockerViaSSH
Socket string
Platform string
SSHUser string
RunAs string
LocalBackends []config.LocalBackend
Mode string
AllContainers bool
TLSVerify bool
CACert string
Cert string
Key string
}
BackendConfig is the runtime settings for one docker backend (search + dial).
func BackendConfigFromYAML ¶
func BackendConfigFromYAML(e config.DockerBackend, locals []config.LocalBackend, sshUser string) BackendConfig
BackendConfigFromYAML converts a config entry to BackendConfig.
func (BackendConfig) ResolvedHost ¶
func (b BackendConfig) ResolvedHost() string
ResolvedHost returns the host URI stored on records for Moby-direct backends.
func (BackendConfig) UsesHoneySSH ¶
func (b BackendConfig) UsesHoneySSH() bool
UsesHoneySSH reports whether this backend dials Docker via Honey SSH + remote socket.
type DialParams ¶
DialParams describes how to dial the remote Engine socket over SSH.
func SocketDialParams ¶
func SocketDialParams(socket, platform string) (DialParams, error)
SocketDialParams maps a socket URI and platform to SSH dial network/address and Moby host URL.
type DiscoverOpts ¶
DiscoverOpts configures auto-discovery pass (feature-flag only).
type Docker ¶
type Docker struct {
Config BackendConfig
}
Docker implements hosts.Backend for Engine API search (local, Moby ssh://, or Honey SSH).
func (*Docker) BackendName ¶
BackendName returns the optional YAML backends.docker[].name value.
func (*Docker) CacheIdentity ¶
CacheIdentity scopes cache entries per docker backend configuration.
type SSHHop ¶
SSHHop is a resolved SSH target for Honey SSH transport to Docker.
func ResolveSSHHop ¶
ResolveSSHHop resolves SSH settings from backend config, optional local backends, or a VM record.
func (SSHHop) RecordHostURI ¶
RecordHostURI returns a stable label stored on docker records.