swarm

package
v0.78.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 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")

Functions

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 GetModeEnabled added in v0.78.0

func GetModeEnabled() bool

GetModeEnabled, Whether the docker host is running in swarm mode, it will return false if ignoreSwarmFeature is true.

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, environment map[string]string, workingDir string) (*types.Config, error)

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

func RefreshModeEnabled added in v0.78.0

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

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 SetDisableSwarmFeature added in v0.78.0

func SetDisableSwarmFeature(ignore bool)

SetDisableSwarmFeature, disable swarm feature.

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