Documentation
¶
Index ¶
- func ListAdvertiseAddrs() ([]string, error)
- func ServiceList(exec *Executor, stackName string) ([]string, error)
- func ServiceRemove(exec *Executor, serviceNames []string) error
- func StackBuild(exec *Executor, contextPath, target, tag string) error
- func StackDeploy(exec *Executor, stackName string, composeData []byte) error
- func StackRemove(exec *Executor, stackName string) error
- func SwarmInit(exec *Executor) error
- func SwarmInitWithAddr(exec *Executor, addr string) error
- func VolumeList(exec *Executor, stackName string) ([]string, error)
- func VolumeRemove(exec *Executor, volumes []string) error
- type Client
- func (c *Client) Close() error
- func (c *Client) IsStackRunning(ctx context.Context, stackName string) (bool, error)
- func (c *Client) ListStackServices(ctx context.Context, stackName string) ([]swarm.Service, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) SwarmStatus(ctx context.Context) (swarm.LocalNodeState, error)
- type Executor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListAdvertiseAddrs ¶
ListAdvertiseAddrs returns non-loopback IPv4 addresses suitable for swarm advertise-addr.
func ServiceList ¶
ServiceList lists service names in a stack, returning only the bare service name (without the "<stack>_" prefix).
func ServiceRemove ¶
ServiceRemove removes specific services by their full Docker service names (<stack>_<service>).
func StackBuild ¶
StackBuild builds a service image from a Dockerfile.
func StackDeploy ¶
StackDeploy deploys a stack from compose YAML data.
func StackRemove ¶
StackRemove removes a deployed stack.
func SwarmInitWithAddr ¶
SwarmInitWithAddr initializes a Docker swarm with a specific advertise address.
func VolumeList ¶
VolumeList lists volumes with an optional filter.
func VolumeRemove ¶
VolumeRemove removes the specified volumes.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Docker SDK client for query operations.
func (*Client) IsStackRunning ¶
IsStackRunning checks if any services for the stack are deployed.
func (*Client) ListStackServices ¶
ListStackServices lists services belonging to a stack, using server-side label filtering to avoid fetching all services on large swarms.
func (*Client) SwarmStatus ¶
SwarmStatus returns the current node's swarm state.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor runs docker CLI commands, handling sudo as needed.
func NewExecutor ¶
NewExecutor creates an Executor that auto-detects sudo requirement or uses the configured preference.
func (*Executor) RunPassthrough ¶
RunPassthrough executes a docker command with stdout/stderr connected to the terminal.
func (*Executor) RunWithStdin ¶
RunWithStdin executes a docker command passing data via stdin.
func (*Executor) SwarmActive ¶
SwarmActive checks whether Docker Swarm is active via the CLI.