swarm

package
v0.72.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ResolveImageAlways  = "always"
	ResolveImageChanged = "changed"
	ResolveImageNever   = "never"
)

ResolveImage constants for controlling image resolution during deployment.

View Source
const (
	StackNamespaceLabel = "com.docker.stack.namespace"
)

Variables

View Source
var ErrNotReplicatedService = errors.New("service is not in replicated or replicated-job mode")
View Source
var ModeEnabled bool // Whether the docker host is running in swarm mode

Functions

func CheckDaemonIsSwarmManager

func CheckDaemonIsSwarmManager(ctx context.Context, dockerCli command.Cli) (bool, error)

CheckDaemonIsSwarmManager does an Info API call to verify that the daemon is a swarm manager. This is necessary because we must create networks before we create services, but the API call for creating a network does not return a proper status code when it can't create a network in the "global" scope.

func GetConfigDetails

func GetConfigDetails(composefiles []string, stdin io.Reader) (types.ConfigDetails, error)

GetConfigDetails parse the composefiles specified in the cli and returns their ConfigDetails.

func GetServicesByLabel added in v0.54.0

func GetServicesByLabel(ctx context.Context, apiclient client.APIClient, labelKey, labelValue string) ([]swarm.Service, error)

func GetStackServices added in v0.45.0

func GetStackServices(ctx context.Context, apiclient client.APIClient, namespace string) ([]swarm.Service, error)

func GetStacks added in v0.45.0

func GetStacks(ctx context.Context, apiclient client.APIClient) (map[string][]swarm.Service, error)

func LoadComposefile

func LoadComposefile(dockerCli command.Cli, opts options.Deploy, resolvedSecrets secrettypes.ResolvedSecrets, workingDir string) (*types.Config, error)

LoadComposefile parse the composefile specified in the cli and returns its Config and version.

func RunDeploy

func RunDeploy(ctx context.Context, dockerCLI command.Cli, opts *options.Deploy, cfg *composetypes.Config) error

RunDeploy is the swarm implementation of docker stack deploy.

func RunRemove

func RunRemove(ctx context.Context, dockerCli command.Cli, opts options.Remove) error

RunRemove is the swarm implementation of docker stack remove.

func ScaleService added in v0.45.0

func ScaleService(ctx context.Context, dockerCLI command.Cli, serviceName string, replicas uint64, wait, force bool) error

func WaitOnServices added in v0.54.0

func WaitOnServices(ctx context.Context, dockerCli command.Cli, serviceIDs []string) error

WaitOnServices waits for the specified Swarm services to complete.

Types

type Service

type Service struct {
	ID string
	swarm.Meta
	Spec         swarm.ServiceSpec   `json:",omitempty"`
	PreviousSpec *swarm.ServiceSpec  `json:",omitempty"`
	Endpoint     swarm.Endpoint      `json:",omitempty"`
	UpdateStatus *swarm.UpdateStatus `json:",omitempty"`

	// ServiceStatus is an optional, extra field indicating the number of
	// desired and running tasks. It is provided primarily as a shortcut to
	// calculating these values client-side, which otherwise would require
	// listing all tasks for a service, an operation that could be
	// computation and network expensive.
	ServiceStatus *swarm.ServiceStatus `json:",omitempty"`

	// JobStatus is the status of a Service which is in one of ReplicatedJob or
	// GlobalJob modes. It is absent on Replicated and Global services.
	JobStatus *swarm.JobStatus `json:",omitempty"`
}

Service represents a service.

Jump to

Keyboard shortcuts

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