Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) CreateExec(ctx context.Context, config *ExecConfig) (*ExecCreateResponse, error)
- func (c *Client) GetDataRoot(ctx context.Context) (string, error)
- func (c *Client) GetVersion(ctx context.Context) (*VersionInfo, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Request(ctx context.Context, method, path string, headers map[string]string, ...) (*http.Response, error)
- func (c *Client) RequestRaw(ctx context.Context, method, path string, headers map[string]string, ...) (*http.Response, error)
- func (c *Client) ResizeExec(ctx context.Context, execID string, height, width int) error
- func (c *Client) StartExecAttach(ctx context.Context, execID string) (*HijackedConn, error)
- func (c *Client) StreamRequest(ctx context.Context, method, path string, headers map[string]string, ...) (*http.Response, error)
- type ComposeClient
- type ComposeOperation
- type ComposeResult
- type ComposeService
- type ExecConfig
- type ExecCreateResponse
- type HijackedConn
- type RegistryCredentials
- type VersionInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps Docker API operations
func (*Client) CreateExec ¶ added in v0.1.0
func (c *Client) CreateExec(ctx context.Context, config *ExecConfig) (*ExecCreateResponse, error)
CreateExec creates a new exec instance in a container
func (*Client) GetDataRoot ¶
GetDataRoot returns Docker's data root directory
func (*Client) GetVersion ¶
func (c *Client) GetVersion(ctx context.Context) (*VersionInfo, error)
GetVersion returns Docker version information
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, method, path string, headers map[string]string, body io.Reader) (*http.Response, error)
Request makes an HTTP request to the Docker API
func (*Client) RequestRaw ¶
func (c *Client) RequestRaw(ctx context.Context, method, path string, headers map[string]string, body io.Reader) (*http.Response, error)
RequestRaw makes a request without API versioning (for proxying)
func (*Client) ResizeExec ¶ added in v0.1.0
ResizeExec resizes the exec terminal
func (*Client) StartExecAttach ¶ added in v0.1.0
StartExecAttach starts an exec instance and returns a hijacked connection
func (*Client) StreamRequest ¶
func (c *Client) StreamRequest(ctx context.Context, method, path string, headers map[string]string, body io.Reader) (*http.Response, error)
StreamRequest makes a streaming request (for logs, exec, events) Uses the pre-initialized streamClient which has no timeout and proper connection pooling
type ComposeClient ¶
type ComposeClient struct {
// contains filtered or unexported fields
}
ComposeClient handles Docker Compose operations
func NewComposeClient ¶
func NewComposeClient(dockerSocket, stacksDir string) *ComposeClient
NewComposeClient creates a new Compose client
func (*ComposeClient) Execute ¶
func (c *ComposeClient) Execute(ctx context.Context, op *ComposeOperation) (*ComposeResult, error)
Execute runs a Docker Compose operation
func (*ComposeClient) GetVersion ¶
func (c *ComposeClient) GetVersion() (string, error)
GetVersion returns docker compose version
func (*ComposeClient) IsAvailable ¶
func (c *ComposeClient) IsAvailable() bool
IsAvailable checks if docker compose is available
func (*ComposeClient) SetAPIVersion ¶ added in v0.2.12
func (c *ComposeClient) SetAPIVersion(version string)
SetAPIVersion sets the Docker API version to use for compose commands. This enables compatibility when the docker CLI version differs from the daemon.
type ComposeOperation ¶
type ComposeOperation struct {
Operation string `json:"operation"` // up, down, pull, ps, logs
ProjectName string `json:"projectName"`
WorkDir string `json:"workDir"`
ComposeFile string `json:"composeFile,omitempty"` // Content of compose file
ComposeFileName string `json:"composeFileName,omitempty"` // Explicit compose filename to use (e.g., "docker-compose.prod.yml")
Files map[string]string `json:"files,omitempty"` // All files to write (relative path -> content)
Services []string `json:"services,omitempty"` // Specific services to operate on
Options map[string]string `json:"options,omitempty"` // Additional options
EnvVars map[string]string `json:"envVars,omitempty"` // Environment variables for variable substitution
Registries []RegistryCredentials `json:"registries,omitempty"` // Registry credentials for docker login
ForceRecreate bool `json:"forceRecreate,omitempty"` // Force recreation of containers (--force-recreate)
RemoveVolumes bool `json:"removeVolumes,omitempty"` // Remove volumes on down (--volumes)
ServiceName string `json:"serviceName,omitempty"` // Target specific service only (with --no-deps)
Build bool `json:"build,omitempty"` // Build images before starting (--build)
}
ComposeOperation represents a compose operation request
type ComposeResult ¶
type ComposeResult struct {
Success bool `json:"success"`
Output string `json:"output"`
Error string `json:"error,omitempty"`
ExitCode int `json:"exitCode"`
}
ComposeResult is the result of a compose operation
type ComposeService ¶
type ComposeService struct {
ID string `json:"ID"`
Name string `json:"Name"`
Service string `json:"Service"`
State string `json:"State"`
Status string `json:"Status"`
Health string `json:"Health,omitempty"`
Image string `json:"Image"`
Publishers []string `json:"Publishers,omitempty"`
}
ComposeService represents a service from docker compose ps
func ParseComposePS ¶
func ParseComposePS(output string) ([]ComposeService, error)
ParseComposePS parses the JSON output of docker compose ps
type ExecConfig ¶ added in v0.1.0
ExecConfig holds the configuration for creating an exec instance
type ExecCreateResponse ¶ added in v0.1.0
type ExecCreateResponse struct {
ID string `json:"Id"`
}
ExecCreateResponse is the response from exec create
type HijackedConn ¶ added in v0.1.0
type HijackedConn struct {
Conn net.Conn
Reader *io.Reader
Leftover []byte // Any data read past the HTTP headers
}
HijackedConn represents a hijacked connection for exec
type RegistryCredentials ¶ added in v0.2.17
type RegistryCredentials struct {
URL string `json:"url"`
Username string `json:"username"`
Password string `json:"password"`
}
RegistryCredentials holds credentials for a Docker registry
type VersionInfo ¶
type VersionInfo struct {
Version string `json:"Version"`
APIVersion string `json:"ApiVersion"`
MinAPIVersion string `json:"MinAPIVersion"`
GitCommit string `json:"GitCommit"`
GoVersion string `json:"GoVersion"`
Os string `json:"Os"`
Arch string `json:"Arch"`
KernelVersion string `json:"KernelVersion"`
BuildTime string `json:"BuildTime"`
}
VersionInfo contains Docker version information