Documentation
¶
Overview ¶
Package docker provides a fleet.Probe implementation that discovers running containers via the local Docker Engine unix socket using raw HTTP/1.1. No github.com/docker/docker SDK is used — stdlib net, net/http, bufio, encoding/json only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Docker Engine unix socket (ENOENT, ECONNREFUSED, etc.). ErrSocketUnavailable = errors.New("fleet/docker: socket unavailable") // ErrEngineError is returned when the Docker Engine responds with a non-2xx // status, returns invalid JSON, or the response body exceeds the size cap. ErrEngineError = errors.New("fleet/docker: engine returned error") // ErrInvalidFilter is returned when Filter.Service contains characters // outside [a-zA-Z0-9._-]. Validated before any network call. ErrInvalidFilter = errors.New("fleet/docker: invalid filter") )
Sentinel errors exposed for callers to errors.Is against.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is the Docker-socket fleet.Probe implementation. It communicates with the local Docker Engine via raw HTTP/1.1 over the unix socket — no github.com/docker/docker SDK dependency.
Driver implements fleet.Probe. Scheme() returns "docker". The alias "local" → docker driver is the caller's concern (P5).
func New ¶
New constructs a Driver with the given options. Callers may use New() with no arguments for the default configuration (socket=/var/run/docker.sock, timeout=10s).
func (*Driver) List ¶
func (d *Driver) List(ctx context.Context, _ fleet.Target, f fleet.Filter) ([]fleet.RuntimeImage, error)
List queries the Docker Engine for running containers and maps them to fleet.RuntimeImage values.
Filter.Labels is intentionally ignored for MVP. Per the fleet.Filter spec, drivers may omit label matching; P5 wiring handles higher-level filtering.
type Option ¶
type Option func(*Driver)
Option configures a Driver.
func WithDialer ¶
WithDialer overrides the unix-socket dialer. Tests inject net.Pipe-backed fakes here to avoid touching the real /var/run/docker.sock.
func WithSocketPath ¶
WithSocketPath overrides the default /var/run/docker.sock. No os.Getenv is used inside this package; socket path must come via this option.
func WithTimeout ¶
WithTimeout sets the per-request timeout. Default 10s.