api

package
v2.27.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 35 Imported by: 83

Documentation

Index

Constants

View Source
const (
	// STARTING indicates that stack is being deployed
	STARTING string = "Starting"
	// RUNNING indicates that stack is deployed and services are running
	RUNNING string = "Running"
	// UPDATING indicates that some stack resources are being recreated
	UPDATING string = "Updating"
	// REMOVING indicates that stack is being deleted
	REMOVING string = "Removing"
	// UNKNOWN indicates unknown stack state
	UNKNOWN string = "Unknown"
	// FAILED indicates that stack deployment failed
	FAILED string = "Failed"
)
View Source
const (
	// RecreateDiverged to recreate services which configuration diverges from compose model
	RecreateDiverged = "diverged"
	// RecreateForce to force service container being recreated
	RecreateForce = "force"
	// RecreateNever to never recreate existing service containers
	RecreateNever = "never"
)
View Source
const (
	// ContainerEventLog is a ContainerEvent of type log on stdout. Line is set
	ContainerEventLog = iota
	// ContainerEventErr is a ContainerEvent of type log on stderr. Line is set
	ContainerEventErr
	// ContainerEventAttach is a ContainerEvent of type attach. First event sent about a container
	ContainerEventAttach
	// ContainerEventStopped is a ContainerEvent of type stopped.
	ContainerEventStopped
	// ContainerEventRecreated let consumer know container stopped but his being replaced
	ContainerEventRecreated
	// ContainerEventExit is a ContainerEvent of type exit. ExitCode is set
	ContainerEventExit
	// UserCancel user cancelled compose up, we are stopping containers
	UserCancel
)
View Source
const (
	// ProjectLabel allow to track resource related to a compose project
	ProjectLabel = "com.docker.compose.project"
	// ServiceLabel allow to track resource related to a compose service
	ServiceLabel = "com.docker.compose.service"
	// ConfigHashLabel stores configuration hash for a compose service
	ConfigHashLabel = "com.docker.compose.config-hash"
	// ContainerNumberLabel stores the container index of a replicated service
	ContainerNumberLabel = "com.docker.compose.container-number"
	// VolumeLabel allow to track resource related to a compose volume
	VolumeLabel = "com.docker.compose.volume"
	// NetworkLabel allow to track resource related to a compose network
	NetworkLabel = "com.docker.compose.network"
	// WorkingDirLabel stores absolute path to compose project working directory
	WorkingDirLabel = "com.docker.compose.project.working_dir"
	// ConfigFilesLabel stores absolute path to compose project configuration files
	ConfigFilesLabel = "com.docker.compose.project.config_files"
	// EnvironmentFileLabel stores absolute path to compose project env file set by `--env-file`
	EnvironmentFileLabel = "com.docker.compose.project.environment_file"
	// OneoffLabel stores value 'True' for one-off containers created by `compose run`
	OneoffLabel = "com.docker.compose.oneoff"
	// SlugLabel stores unique slug used for one-off container identity
	SlugLabel = "com.docker.compose.slug"
	// ImageDigestLabel stores digest of the container image used to run service
	ImageDigestLabel = "com.docker.compose.image"
	// DependenciesLabel stores service dependencies
	DependenciesLabel = "com.docker.compose.depends_on"
	// VersionLabel stores the compose tool version used to build/run application
	VersionLabel = "com.docker.compose.version"
	// ImageBuilderLabel stores the builder (classic or BuildKit) used to produce the image.
	ImageBuilderLabel = "com.docker.compose.image.builder"
	// ContainerReplaceLabel is set when container is created to replace another container (recreated)
	ContainerReplaceLabel = "com.docker.compose.replace"
)
View Source
const (
	DRYRUN_PREFIX = " DRY-RUN MODE - "
)
View Source
const (
	// ExitCodeLoginRequired exit code when command cannot execute because it requires cloud login
	// This will be used by VSCode to detect when creating context if the user needs to login first
	ExitCodeLoginRequired = 5
)
View Source
const WatchLogger = "#watch"

WatchLogger is a reserved name to log watch events

Variables

View Source
var (
	// ErrNotFound is returned when an object is not found
	ErrNotFound = errors.New("not found")
	// ErrAlreadyExists is returned when an object already exists
	ErrAlreadyExists = errors.New("already exists")
	// ErrForbidden is returned when an operation is not permitted
	ErrForbidden = errors.New("forbidden")
	// ErrUnknown is returned when the error type is unmapped
	ErrUnknown = errors.New("unknown")
	// ErrLoginFailed is returned when login failed
	ErrLoginFailed = errors.New("login failed")
	// ErrLoginRequired is returned when login is required for a specific action
	ErrLoginRequired = errors.New("login required")
	// ErrNotImplemented is returned when a backend doesn't implement
	// an action
	ErrNotImplemented = errors.New("not implemented")
	// ErrUnsupportedFlag is returned when a backend doesn't support a flag
	ErrUnsupportedFlag = errors.New("unsupported flag")
	// ErrCanceled is returned when the command was canceled by user
	ErrCanceled = errors.New("canceled")
	// ErrParsingFailed is returned when a string cannot be parsed
	ErrParsingFailed = errors.New("parsing failed")
	// ErrWrongContextType is returned when the caller tries to get a context
	// with the wrong type
	ErrWrongContextType = errors.New("wrong context type")
)
View Source
var ComposeVersion string

ComposeVersion is the compose tool version as declared by label VersionLabel

View Source
var Separator = "-"

Separator is used for naming components

Functions

func GetImageNameOrDefault added in v2.8.0

func GetImageNameOrDefault(service types.ServiceConfig, projectName string) string

GetImageNameOrDefault computes the default image name for a service, used to tag built images

func IsAlreadyExistsError

func IsAlreadyExistsError(err error) bool

IsAlreadyExistsError returns true if the unwrapped error is ErrAlreadyExists

func IsErrCanceled

func IsErrCanceled(err error) bool

IsErrCanceled returns true if the unwrapped error is ErrCanceled

func IsErrNotImplemented

func IsErrNotImplemented(err error) bool

IsErrNotImplemented returns true if the unwrapped error is ErrNotImplemented

func IsErrParsingFailed

func IsErrParsingFailed(err error) bool

IsErrParsingFailed returns true if the unwrapped error is ErrParsingFailed

func IsErrUnsupportedFlag

func IsErrUnsupportedFlag(err error) bool

IsErrUnsupportedFlag returns true if the unwrapped error is ErrUnsupportedFlag

func IsForbiddenError

func IsForbiddenError(err error) bool

IsForbiddenError returns true if the unwrapped error is ErrForbidden

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError returns true if the unwrapped error is ErrNotFound

func IsUnknownError

func IsUnknownError(err error) bool

IsUnknownError returns true if the unwrapped error is ErrUnknown

Types

type AttachOptions added in v2.24.0

type AttachOptions struct {
	Project    *types.Project
	Service    string
	Index      int
	DetachKeys string
	NoStdin    bool
	Proxy      bool
}

AttachOptions group options of the Attach API

type BuildOptions

type BuildOptions struct {
	// Pull always attempt to pull a newer version of the image
	Pull bool
	// Push pushes service images
	Push bool
	// Progress set type of progress output ("auto", "plain", "tty")
	Progress string
	// Args set build-time args
	Args types.MappingWithEquals
	// NoCache disables cache use
	NoCache bool
	// Quiet make the build process not output to the console
	Quiet bool
	// Services passed in the command line to be built
	Services []string
	// Deps also build selected services dependencies
	Deps bool
	// Ssh authentications passed in the command line
	SSHs []types.SSHKey
	// Memory limit for the build container
	Memory int64
	// Builder name passed in the command line
	Builder string
}

BuildOptions group options of the Build API

func (BuildOptions) Apply added in v2.17.0

func (o BuildOptions) Apply(project *types.Project) error

Apply mutates project according to build options

type Cascade added in v2.27.0

type Cascade int
const (
	CascadeIgnore Cascade = iota
	CascadeStop   Cascade = iota
	CascadeFail   Cascade = iota
)

type ConfigOptions added in v2.16.0

type ConfigOptions struct {
	// Format define the output format used to dump converted application model (json|yaml)
	Format string
	// Output defines the path to save the application model
	Output string
	// Resolve image reference to digests
	ResolveImageDigests bool
}

ConfigOptions group options of the Config API

type ContainerEvent

type ContainerEvent struct {
	Type int
	// Container is the name of the container _without the project prefix_.
	//
	// This is only suitable for display purposes within Compose, as it's
	// not guaranteed to be unique across services.
	Container string
	ID        string
	Service   string
	Line      string
	// ContainerEventExit only
	ExitCode   int
	Restarting bool
}

ContainerEvent notify an event has been collected on source container implementing Service

type ContainerEventListener

type ContainerEventListener func(event ContainerEvent)

ContainerEventListener is a callback to process ContainerEvent from services

type ContainerProcSummary

type ContainerProcSummary struct {
	ID        string
	Name      string
	Processes [][]string
	Titles    []string
}

ContainerProcSummary holds container processes top data

type ContainerSummary

type ContainerSummary struct {
	ID           string
	Name         string
	Names        []string
	Image        string
	Command      string
	Project      string
	Service      string
	Created      int64
	State        string
	Status       string
	Health       string
	ExitCode     int
	Publishers   PortPublishers
	Labels       map[string]string
	SizeRw       int64 `json:",omitempty"`
	SizeRootFs   int64 `json:",omitempty"`
	Mounts       []string
	Networks     []string
	LocalVolumes int
}

ContainerSummary hold high-level description of a container

type CopyOptions

type CopyOptions struct {
	Source      string
	Destination string
	All         bool
	Index       int
	FollowLink  bool
	CopyUIDGID  bool
}

CopyOptions group options of the cp API

type CreateOptions

type CreateOptions struct {
	Build *BuildOptions
	// Services defines the services user interacts with
	Services []string
	// Remove legacy containers for services that are not defined in the project
	RemoveOrphans bool
	// Ignore legacy containers for services that are not defined in the project
	IgnoreOrphans bool
	// Recreate define the strategy to apply on existing containers
	Recreate string
	// RecreateDependencies define the strategy to apply on dependencies services
	RecreateDependencies string
	// Inherit reuse anonymous volumes from previous container
	Inherit bool
	// Timeout set delay to wait for container to gracelfuly stop before sending SIGKILL
	Timeout *time.Duration
	// QuietPull makes the pulling process quiet
	QuietPull bool
}

CreateOptions group options of the Create API

type DownOptions

type DownOptions struct {
	// RemoveOrphans will cleanup containers that are not declared on the compose model but own the same labels
	RemoveOrphans bool
	// Project is the compose project used to define this app. Might be nil if user ran `down` just with project name
	Project *types.Project
	// Timeout override container stop timeout
	Timeout *time.Duration
	// Images remove image used by services. 'all': Remove all images. 'local': Remove only images that don't have a tag
	Images string
	// Volumes remove volumes, both declared in the `volumes` section and anonymous ones
	Volumes bool
	// Services passed in the command line to be stopped
	Services []string
}

DownOptions group options of the Down API

type DryRunClient added in v2.16.0

type DryRunClient struct {
	// contains filtered or unexported fields
}

DryRunClient implements APIClient by delegating to implementation functions. This allows lazy init and per-method overrides

func NewDryRunClient added in v2.16.0

func NewDryRunClient(apiClient client.APIClient, cli command.Cli) (*DryRunClient, error)

NewDryRunClient produces a DryRunClient

func (*DryRunClient) BuildCachePrune added in v2.16.0

func (*DryRunClient) BuildCancel added in v2.16.0

func (d *DryRunClient) BuildCancel(ctx context.Context, id string) error

func (*DryRunClient) CheckpointCreate added in v2.16.0

func (d *DryRunClient) CheckpointCreate(ctx context.Context, container string, options checkpoint.CreateOptions) error

func (*DryRunClient) CheckpointDelete added in v2.16.0

func (d *DryRunClient) CheckpointDelete(ctx context.Context, container string, options checkpoint.DeleteOptions) error

func (*DryRunClient) CheckpointList added in v2.16.0

func (d *DryRunClient) CheckpointList(ctx context.Context, container string, options checkpoint.ListOptions) ([]checkpoint.Summary, error)

func (*DryRunClient) ClientVersion added in v2.16.0

func (d *DryRunClient) ClientVersion() string

func (*DryRunClient) Close added in v2.16.0

func (d *DryRunClient) Close() error

func (*DryRunClient) ConfigCreate added in v2.16.0

func (d *DryRunClient) ConfigCreate(ctx context.Context, config swarm.ConfigSpec) (moby.ConfigCreateResponse, error)

func (*DryRunClient) ConfigInspectWithRaw added in v2.16.0

func (d *DryRunClient) ConfigInspectWithRaw(ctx context.Context, name string) (swarm.Config, []byte, error)

func (*DryRunClient) ConfigList added in v2.16.0

func (d *DryRunClient) ConfigList(ctx context.Context, options moby.ConfigListOptions) ([]swarm.Config, error)

func (*DryRunClient) ConfigRemove added in v2.16.0

func (d *DryRunClient) ConfigRemove(ctx context.Context, id string) error

func (*DryRunClient) ConfigUpdate added in v2.16.0

func (d *DryRunClient) ConfigUpdate(ctx context.Context, id string, version swarm.Version, config swarm.ConfigSpec) error

func (*DryRunClient) ContainerAttach added in v2.16.0

func (d *DryRunClient) ContainerAttach(ctx context.Context, container string, options containerType.AttachOptions) (moby.HijackedResponse, error)

func (*DryRunClient) ContainerCommit added in v2.16.0

func (d *DryRunClient) ContainerCommit(ctx context.Context, container string, options containerType.CommitOptions) (moby.IDResponse, error)

func (*DryRunClient) ContainerCreate added in v2.16.0

func (d *DryRunClient) ContainerCreate(ctx context.Context, config *containerType.Config, hostConfig *containerType.HostConfig,
	networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (containerType.CreateResponse, error)

func (*DryRunClient) ContainerDiff added in v2.16.0

func (d *DryRunClient) ContainerDiff(ctx context.Context, container string) ([]containerType.FilesystemChange, error)

func (*DryRunClient) ContainerExecAttach added in v2.16.0

func (d *DryRunClient) ContainerExecAttach(ctx context.Context, execID string, config moby.ExecStartCheck) (moby.HijackedResponse, error)

func (*DryRunClient) ContainerExecCreate added in v2.16.0

func (d *DryRunClient) ContainerExecCreate(ctx context.Context, container string, config moby.ExecConfig) (moby.IDResponse, error)

func (*DryRunClient) ContainerExecInspect added in v2.16.0

func (d *DryRunClient) ContainerExecInspect(ctx context.Context, execID string) (moby.ContainerExecInspect, error)

func (*DryRunClient) ContainerExecResize added in v2.16.0

func (d *DryRunClient) ContainerExecResize(ctx context.Context, execID string, options containerType.ResizeOptions) error

func (*DryRunClient) ContainerExecStart added in v2.16.0

func (d *DryRunClient) ContainerExecStart(ctx context.Context, execID string, config moby.ExecStartCheck) error

func (*DryRunClient) ContainerExport added in v2.16.0

func (d *DryRunClient) ContainerExport(ctx context.Context, container string) (io.ReadCloser, error)

func (*DryRunClient) ContainerInspect added in v2.16.0

func (d *DryRunClient) ContainerInspect(ctx context.Context, container string) (moby.ContainerJSON, error)

func (*DryRunClient) ContainerInspectWithRaw added in v2.16.0

func (d *DryRunClient) ContainerInspectWithRaw(ctx context.Context, container string, getSize bool) (moby.ContainerJSON, []byte, error)

func (*DryRunClient) ContainerKill added in v2.16.0

func (d *DryRunClient) ContainerKill(ctx context.Context, container, signal string) error

func (*DryRunClient) ContainerList added in v2.16.0

func (d *DryRunClient) ContainerList(ctx context.Context, options containerType.ListOptions) ([]moby.Container, error)

func (*DryRunClient) ContainerLogs added in v2.16.0

func (d *DryRunClient) ContainerLogs(ctx context.Context, container string, options containerType.LogsOptions) (io.ReadCloser, error)

func (*DryRunClient) ContainerPause added in v2.16.0

func (d *DryRunClient) ContainerPause(ctx context.Context, container string) error

func (*DryRunClient) ContainerRemove added in v2.16.0

func (d *DryRunClient) ContainerRemove(ctx context.Context, container string, options containerType.RemoveOptions) error

func (*DryRunClient) ContainerRename added in v2.16.0

func (d *DryRunClient) ContainerRename(ctx context.Context, container, newContainerName string) error

func (*DryRunClient) ContainerResize added in v2.16.0

func (d *DryRunClient) ContainerResize(ctx context.Context, container string, options containerType.ResizeOptions) error

func (*DryRunClient) ContainerRestart added in v2.16.0

func (d *DryRunClient) ContainerRestart(ctx context.Context, container string, options containerType.StopOptions) error

func (*DryRunClient) ContainerStart added in v2.16.0

func (d *DryRunClient) ContainerStart(ctx context.Context, container string, options containerType.StartOptions) error

func (*DryRunClient) ContainerStatPath added in v2.16.0

func (d *DryRunClient) ContainerStatPath(ctx context.Context, container, path string) (moby.ContainerPathStat, error)

func (*DryRunClient) ContainerStats added in v2.16.0

func (d *DryRunClient) ContainerStats(ctx context.Context, container string, stream bool) (moby.ContainerStats, error)

func (*DryRunClient) ContainerStatsOneShot added in v2.16.0

func (d *DryRunClient) ContainerStatsOneShot(ctx context.Context, container string) (moby.ContainerStats, error)

func (*DryRunClient) ContainerStop added in v2.16.0

func (d *DryRunClient) ContainerStop(ctx context.Context, container string, options containerType.StopOptions) error

func (*DryRunClient) ContainerTop added in v2.16.0

func (d *DryRunClient) ContainerTop(ctx context.Context, container string, arguments []string) (containerType.ContainerTopOKBody, error)

func (*DryRunClient) ContainerUnpause added in v2.16.0

func (d *DryRunClient) ContainerUnpause(ctx context.Context, container string) error

func (*DryRunClient) ContainerUpdate added in v2.16.0

func (d *DryRunClient) ContainerUpdate(ctx context.Context, container string, updateConfig containerType.UpdateConfig) (containerType.ContainerUpdateOKBody, error)

func (*DryRunClient) ContainerWait added in v2.16.0

func (d *DryRunClient) ContainerWait(ctx context.Context, container string, condition containerType.WaitCondition) (<-chan containerType.WaitResponse, <-chan error)

func (*DryRunClient) ContainersPrune added in v2.16.0

func (d *DryRunClient) ContainersPrune(ctx context.Context, pruneFilters filters.Args) (moby.ContainersPruneReport, error)

func (*DryRunClient) CopyFromContainer added in v2.16.0

func (d *DryRunClient) CopyFromContainer(ctx context.Context, container, srcPath string) (io.ReadCloser, moby.ContainerPathStat, error)

func (*DryRunClient) CopyToContainer added in v2.16.0

func (d *DryRunClient) CopyToContainer(ctx context.Context, container, path string, content io.Reader, options moby.CopyToContainerOptions) error

func (*DryRunClient) DaemonHost added in v2.16.0

func (d *DryRunClient) DaemonHost() string

func (*DryRunClient) DialHijack added in v2.16.0

func (d *DryRunClient) DialHijack(ctx context.Context, url, proto string, meta map[string][]string) (net.Conn, error)

func (*DryRunClient) Dialer added in v2.16.0

func (d *DryRunClient) Dialer() func(context.Context) (net.Conn, error)

func (*DryRunClient) DiskUsage added in v2.16.0

func (d *DryRunClient) DiskUsage(ctx context.Context, options moby.DiskUsageOptions) (moby.DiskUsage, error)

func (*DryRunClient) DistributionInspect added in v2.16.0

func (d *DryRunClient) DistributionInspect(ctx context.Context, imageName, encodedRegistryAuth string) (registry.DistributionInspect, error)

func (*DryRunClient) Events added in v2.16.0

func (d *DryRunClient) Events(ctx context.Context, options moby.EventsOptions) (<-chan events.Message, <-chan error)

func (*DryRunClient) HTTPClient added in v2.16.0

func (d *DryRunClient) HTTPClient() *http.Client

func (*DryRunClient) ImageBuild added in v2.16.0

func (d *DryRunClient) ImageBuild(ctx context.Context, reader io.Reader, options moby.ImageBuildOptions) (moby.ImageBuildResponse, error)

func (*DryRunClient) ImageCreate added in v2.16.0

func (d *DryRunClient) ImageCreate(ctx context.Context, parentReference string, options image.CreateOptions) (io.ReadCloser, error)

func (*DryRunClient) ImageHistory added in v2.16.0

func (d *DryRunClient) ImageHistory(ctx context.Context, imageName string) ([]image.HistoryResponseItem, error)

func (*DryRunClient) ImageImport added in v2.16.0

func (d *DryRunClient) ImageImport(ctx context.Context, source moby.ImageImportSource, ref string, options image.ImportOptions) (io.ReadCloser, error)

func (*DryRunClient) ImageInspectWithRaw added in v2.16.0

func (d *DryRunClient) ImageInspectWithRaw(ctx context.Context, imageName string) (moby.ImageInspect, []byte, error)

func (*DryRunClient) ImageList added in v2.16.0

func (d *DryRunClient) ImageList(ctx context.Context, options image.ListOptions) ([]image.Summary, error)

func (*DryRunClient) ImageLoad added in v2.16.0

func (d *DryRunClient) ImageLoad(ctx context.Context, input io.Reader, quiet bool) (moby.ImageLoadResponse, error)

func (*DryRunClient) ImagePull added in v2.16.0

func (d *DryRunClient) ImagePull(ctx context.Context, ref string, options image.PullOptions) (io.ReadCloser, error)

func (*DryRunClient) ImagePush added in v2.16.0

func (d *DryRunClient) ImagePush(ctx context.Context, ref string, options image.PushOptions) (io.ReadCloser, error)

func (*DryRunClient) ImageRemove added in v2.16.0

func (d *DryRunClient) ImageRemove(ctx context.Context, imageName string, options image.RemoveOptions) ([]image.DeleteResponse, error)

func (*DryRunClient) ImageSave added in v2.16.0

func (d *DryRunClient) ImageSave(ctx context.Context, images []string) (io.ReadCloser, error)

func (*DryRunClient) ImageSearch added in v2.16.0

func (d *DryRunClient) ImageSearch(ctx context.Context, term string, options moby.ImageSearchOptions) ([]registry.SearchResult, error)

func (*DryRunClient) ImageTag added in v2.16.0

func (d *DryRunClient) ImageTag(ctx context.Context, imageName, ref string) error

func (*DryRunClient) ImagesPrune added in v2.16.0

func (d *DryRunClient) ImagesPrune(ctx context.Context, pruneFilter filters.Args) (moby.ImagesPruneReport, error)

func (*DryRunClient) Info added in v2.16.0

func (d *DryRunClient) Info(ctx context.Context) (system.Info, error)

func (*DryRunClient) NegotiateAPIVersion added in v2.16.0

func (d *DryRunClient) NegotiateAPIVersion(ctx context.Context)

func (*DryRunClient) NegotiateAPIVersionPing added in v2.16.0

func (d *DryRunClient) NegotiateAPIVersionPing(ping moby.Ping)

func (*DryRunClient) NetworkConnect added in v2.16.0

func (d *DryRunClient) NetworkConnect(ctx context.Context, networkName, container string, config *network.EndpointSettings) error

func (*DryRunClient) NetworkCreate added in v2.16.0

func (d *DryRunClient) NetworkCreate(ctx context.Context, name string, options moby.NetworkCreate) (moby.NetworkCreateResponse, error)

func (*DryRunClient) NetworkDisconnect added in v2.16.0

func (d *DryRunClient) NetworkDisconnect(ctx context.Context, networkName, container string, force bool) error

func (*DryRunClient) NetworkInspect added in v2.16.0

func (d *DryRunClient) NetworkInspect(ctx context.Context, networkName string, options moby.NetworkInspectOptions) (moby.NetworkResource, error)

func (*DryRunClient) NetworkInspectWithRaw added in v2.16.0

func (d *DryRunClient) NetworkInspectWithRaw(ctx context.Context, networkName string, options moby.NetworkInspectOptions) (moby.NetworkResource, []byte, error)

func (*DryRunClient) NetworkList added in v2.16.0

func (d *DryRunClient) NetworkList(ctx context.Context, options moby.NetworkListOptions) ([]moby.NetworkResource, error)

func (*DryRunClient) NetworkRemove added in v2.16.0

func (d *DryRunClient) NetworkRemove(ctx context.Context, networkName string) error

func (*DryRunClient) NetworksPrune added in v2.16.0

func (d *DryRunClient) NetworksPrune(ctx context.Context, pruneFilter filters.Args) (moby.NetworksPruneReport, error)

func (*DryRunClient) NodeInspectWithRaw added in v2.16.0

func (d *DryRunClient) NodeInspectWithRaw(ctx context.Context, nodeID string) (swarm.Node, []byte, error)

func (*DryRunClient) NodeList added in v2.16.0

func (d *DryRunClient) NodeList(ctx context.Context, options moby.NodeListOptions) ([]swarm.Node, error)

func (*DryRunClient) NodeRemove added in v2.16.0

func (d *DryRunClient) NodeRemove(ctx context.Context, nodeID string, options moby.NodeRemoveOptions) error

func (*DryRunClient) NodeUpdate added in v2.16.0

func (d *DryRunClient) NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error

func (*DryRunClient) Ping added in v2.16.0

func (d *DryRunClient) Ping(ctx context.Context) (moby.Ping, error)

func (*DryRunClient) PluginCreate added in v2.16.0

func (d *DryRunClient) PluginCreate(ctx context.Context, createContext io.Reader, options moby.PluginCreateOptions) error

func (*DryRunClient) PluginDisable added in v2.16.0

func (d *DryRunClient) PluginDisable(ctx context.Context, name string, options moby.PluginDisableOptions) error

func (*DryRunClient) PluginEnable added in v2.16.0

func (d *DryRunClient) PluginEnable(ctx context.Context, name string, options moby.PluginEnableOptions) error

func (*DryRunClient) PluginInspectWithRaw added in v2.16.0

func (d *DryRunClient) PluginInspectWithRaw(ctx context.Context, name string) (*moby.Plugin, []byte, error)

func (*DryRunClient) PluginInstall added in v2.16.0

func (d *DryRunClient) PluginInstall(ctx context.Context, name string, options moby.PluginInstallOptions) (io.ReadCloser, error)

func (*DryRunClient) PluginList added in v2.16.0

func (d *DryRunClient) PluginList(ctx context.Context, filter filters.Args) (moby.PluginsListResponse, error)

func (*DryRunClient) PluginPush added in v2.16.0

func (d *DryRunClient) PluginPush(ctx context.Context, name string, registryAuth string) (io.ReadCloser, error)

func (*DryRunClient) PluginRemove added in v2.16.0

func (d *DryRunClient) PluginRemove(ctx context.Context, name string, options moby.PluginRemoveOptions) error

func (*DryRunClient) PluginSet added in v2.16.0

func (d *DryRunClient) PluginSet(ctx context.Context, name string, args []string) error

func (*DryRunClient) PluginUpgrade added in v2.16.0

func (d *DryRunClient) PluginUpgrade(ctx context.Context, name string, options moby.PluginInstallOptions) (io.ReadCloser, error)

func (*DryRunClient) RegistryLogin added in v2.16.0

func (*DryRunClient) SecretCreate added in v2.16.0

func (d *DryRunClient) SecretCreate(ctx context.Context, secret swarm.SecretSpec) (moby.SecretCreateResponse, error)

func (*DryRunClient) SecretInspectWithRaw added in v2.16.0

func (d *DryRunClient) SecretInspectWithRaw(ctx context.Context, name string) (swarm.Secret, []byte, error)

func (*DryRunClient) SecretList added in v2.16.0

func (d *DryRunClient) SecretList(ctx context.Context, options moby.SecretListOptions) ([]swarm.Secret, error)

func (*DryRunClient) SecretRemove added in v2.16.0

func (d *DryRunClient) SecretRemove(ctx context.Context, id string) error

func (*DryRunClient) SecretUpdate added in v2.16.0

func (d *DryRunClient) SecretUpdate(ctx context.Context, id string, version swarm.Version, secret swarm.SecretSpec) error

func (*DryRunClient) ServerVersion added in v2.16.0

func (d *DryRunClient) ServerVersion(ctx context.Context) (moby.Version, error)

func (*DryRunClient) ServiceCreate added in v2.16.0

func (*DryRunClient) ServiceInspectWithRaw added in v2.16.0

func (d *DryRunClient) ServiceInspectWithRaw(ctx context.Context, serviceID string, options moby.ServiceInspectOptions) (swarm.Service, []byte, error)

func (*DryRunClient) ServiceList added in v2.16.0

func (d *DryRunClient) ServiceList(ctx context.Context, options moby.ServiceListOptions) ([]swarm.Service, error)

func (*DryRunClient) ServiceLogs added in v2.16.0

func (d *DryRunClient) ServiceLogs(ctx context.Context, serviceID string, options containerType.LogsOptions) (io.ReadCloser, error)

func (*DryRunClient) ServiceRemove added in v2.16.0

func (d *DryRunClient) ServiceRemove(ctx context.Context, serviceID string) error

func (*DryRunClient) ServiceUpdate added in v2.16.0

func (d *DryRunClient) ServiceUpdate(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options moby.ServiceUpdateOptions) (swarm.ServiceUpdateResponse, error)

func (*DryRunClient) SwarmGetUnlockKey added in v2.16.0

func (d *DryRunClient) SwarmGetUnlockKey(ctx context.Context) (moby.SwarmUnlockKeyResponse, error)

func (*DryRunClient) SwarmInit added in v2.16.0

func (d *DryRunClient) SwarmInit(ctx context.Context, req swarm.InitRequest) (string, error)

func (*DryRunClient) SwarmInspect added in v2.16.0

func (d *DryRunClient) SwarmInspect(ctx context.Context) (swarm.Swarm, error)

func (*DryRunClient) SwarmJoin added in v2.16.0

func (d *DryRunClient) SwarmJoin(ctx context.Context, req swarm.JoinRequest) error

func (*DryRunClient) SwarmLeave added in v2.16.0

func (d *DryRunClient) SwarmLeave(ctx context.Context, force bool) error

func (*DryRunClient) SwarmUnlock added in v2.16.0

func (d *DryRunClient) SwarmUnlock(ctx context.Context, req swarm.UnlockRequest) error

func (*DryRunClient) SwarmUpdate added in v2.16.0

func (d *DryRunClient) SwarmUpdate(ctx context.Context, version swarm.Version, swarmSpec swarm.Spec, flags swarm.UpdateFlags) error

func (*DryRunClient) TaskInspectWithRaw added in v2.16.0

func (d *DryRunClient) TaskInspectWithRaw(ctx context.Context, taskID string) (swarm.Task, []byte, error)

func (*DryRunClient) TaskList added in v2.16.0

func (d *DryRunClient) TaskList(ctx context.Context, options moby.TaskListOptions) ([]swarm.Task, error)

func (*DryRunClient) TaskLogs added in v2.16.0

func (d *DryRunClient) TaskLogs(ctx context.Context, taskID string, options containerType.LogsOptions) (io.ReadCloser, error)

func (*DryRunClient) VolumeCreate added in v2.16.0

func (d *DryRunClient) VolumeCreate(ctx context.Context, options volume.CreateOptions) (volume.Volume, error)

func (*DryRunClient) VolumeInspect added in v2.16.0

func (d *DryRunClient) VolumeInspect(ctx context.Context, volumeID string) (volume.Volume, error)

func (*DryRunClient) VolumeInspectWithRaw added in v2.16.0

func (d *DryRunClient) VolumeInspectWithRaw(ctx context.Context, volumeID string) (volume.Volume, []byte, error)

func (*DryRunClient) VolumeList added in v2.16.0

func (d *DryRunClient) VolumeList(ctx context.Context, opts volume.ListOptions) (volume.ListResponse, error)

func (*DryRunClient) VolumeRemove added in v2.16.0

func (d *DryRunClient) VolumeRemove(ctx context.Context, volumeID string, force bool) error

func (*DryRunClient) VolumeUpdate added in v2.16.0

func (d *DryRunClient) VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error

func (*DryRunClient) VolumesPrune added in v2.16.0

func (d *DryRunClient) VolumesPrune(ctx context.Context, pruneFilter filters.Args) (moby.VolumesPruneReport, error)

type DryRunKey added in v2.16.0

type DryRunKey struct{}

type Event

type Event struct {
	Timestamp  time.Time
	Service    string
	Container  string
	Status     string
	Attributes map[string]string
}

Event is a container runtime event served by Events API

func (Event) String

func (e Event) String() string

type EventsOptions

type EventsOptions struct {
	Services []string
	Consumer func(event Event) error
}

EventsOptions group options of the Events API

type ImageSummary

type ImageSummary struct {
	ID            string
	ContainerName string
	Repository    string
	Tag           string
	Size          int64
}

ImageSummary holds container image description

type ImagesOptions

type ImagesOptions struct {
	Services []string
}

ImagesOptions group options of the Images API

type KillOptions

type KillOptions struct {
	// RemoveOrphans will cleanup containers that are not declared on the compose model but own the same labels
	RemoveOrphans bool
	// Project is the compose project used to define this app. Might be nil if user ran command just with project name
	Project *types.Project
	// Services passed in the command line to be killed
	Services []string
	// Signal to send to containers
	Signal string
	// All can be set to true to try to kill all found containers, independently of their state
	All bool
}

KillOptions group options of the Kill API

type ListOptions

type ListOptions struct {
	All bool
}

ListOptions group options of the ls API

type LogConsumer

type LogConsumer interface {
	Log(containerName, message string)
	Err(containerName, message string)
	Status(container, msg string)
	Register(container string)
}

LogConsumer is a callback to process log messages from services

type LogOptions

type LogOptions struct {
	Project    *types.Project
	Index      int
	Services   []string
	Tail       string
	Since      string
	Until      string
	Follow     bool
	Timestamps bool
}

LogOptions defines optional parameters for the `Log` API

type OCIVersion added in v2.24.0

type OCIVersion string

OCIVersion controls manifest generation to ensure compatibility with different registries.

Currently, this is not exposed as an option to the user – Compose uses OCI 1.0 mode automatically for ECR registries based on domain and OCI 1.1 for all other registries.

There are likely other popular registries that do not support the OCI 1.1 format, so it might make sense to expose this as a CLI flag or see if there's a way to generically probe the registry for support level.

const (
	OCIVersion1_0 OCIVersion = "1.0"
	OCIVersion1_1 OCIVersion = "1.1"
)

type PauseOptions

type PauseOptions struct {
	// Services passed in the command line to be started
	Services []string
	// Project is the compose project used to define this app. Might be nil if user ran command just with project name
	Project *types.Project
}

PauseOptions group options of the Pause API

type PortOptions

type PortOptions struct {
	Protocol string
	Index    int
}

PortOptions group options of the Port API

type PortPublisher

type PortPublisher struct {
	URL           string
	TargetPort    int
	PublishedPort int
	Protocol      string
}

PortPublisher hold status about published port

type PortPublishers

type PortPublishers []PortPublisher

PortPublishers is a slice of PortPublisher

func (PortPublishers) Len

func (p PortPublishers) Len() int

Len implements sort.Interface

func (PortPublishers) Less

func (p PortPublishers) Less(i, j int) bool

Less implements sort.Interface

func (PortPublishers) Swap

func (p PortPublishers) Swap(i, j int)

Swap implements sort.Interface

type PsOptions

type PsOptions struct {
	Project  *types.Project
	All      bool
	Services []string
}

PsOptions group options of the Ps API

type PublishOptions added in v2.22.0

type PublishOptions struct {
	ResolveImageDigests bool

	OCIVersion OCIVersion
}

PublishOptions group options of the Publish API

type PullOptions

type PullOptions struct {
	Quiet           bool
	IgnoreFailures  bool
	IgnoreBuildable bool
}

PullOptions group options of the Pull API

type PushOptions

type PushOptions struct {
	Quiet          bool
	IgnoreFailures bool
}

PushOptions group options of the Push API

type RemoveOptions

type RemoveOptions struct {
	// Project is the compose project used to define this app. Might be nil if user ran command just with project name
	Project *types.Project
	// Stop option passed in the command line
	Stop bool
	// Volumes remove anonymous volumes
	Volumes bool
	// Force don't ask to confirm removal
	Force bool
	// Services passed in the command line to be removed
	Services []string
}

RemoveOptions group options of the Remove API

type RestartOptions

type RestartOptions struct {
	// Project is the compose project used to define this app. Might be nil if user ran command just with project name
	Project *types.Project
	// Timeout override container restart timeout
	Timeout *time.Duration
	// Services passed in the command line to be restarted
	Services []string
	// NoDeps ignores services dependencies
	NoDeps bool
}

RestartOptions group options of the Restart API

type RunOptions

type RunOptions struct {
	Build *BuildOptions
	// Project is the compose project used to define this app. Might be nil if user ran command just with project name
	Project           *types.Project
	Name              string
	Service           string
	Command           []string
	Entrypoint        []string
	Detach            bool
	AutoRemove        bool
	Tty               bool
	Interactive       bool
	WorkingDir        string
	User              string
	Environment       []string
	CapAdd            []string
	CapDrop           []string
	Labels            types.Labels
	Privileged        bool
	UseNetworkAliases bool
	NoDeps            bool
	// QuietPull makes the pulling process quiet
	QuietPull bool
	// used by exec
	Index int
}

RunOptions group options of the Run API

type ScaleOptions added in v2.22.0

type ScaleOptions struct {
	Services []string
}

type Service

type Service interface {
	// Build executes the equivalent to a `compose build`
	Build(ctx context.Context, project *types.Project, options BuildOptions) error
	// Push executes the equivalent to a `compose push`
	Push(ctx context.Context, project *types.Project, options PushOptions) error
	// Pull executes the equivalent of a `compose pull`
	Pull(ctx context.Context, project *types.Project, options PullOptions) error
	// Create executes the equivalent to a `compose create`
	Create(ctx context.Context, project *types.Project, options CreateOptions) error
	// Start executes the equivalent to a `compose start`
	Start(ctx context.Context, projectName string, options StartOptions) error
	// Restart restarts containers
	Restart(ctx context.Context, projectName string, options RestartOptions) error
	// Stop executes the equivalent to a `compose stop`
	Stop(ctx context.Context, projectName string, options StopOptions) error
	// Up executes the equivalent to a `compose up`
	Up(ctx context.Context, project *types.Project, options UpOptions) error
	// Down executes the equivalent to a `compose down`
	Down(ctx context.Context, projectName string, options DownOptions) error
	// Logs executes the equivalent to a `compose logs`
	Logs(ctx context.Context, projectName string, consumer LogConsumer, options LogOptions) error
	// Ps executes the equivalent to a `compose ps`
	Ps(ctx context.Context, projectName string, options PsOptions) ([]ContainerSummary, error)
	// List executes the equivalent to a `docker stack ls`
	List(ctx context.Context, options ListOptions) ([]Stack, error)
	// Kill executes the equivalent to a `compose kill`
	Kill(ctx context.Context, projectName string, options KillOptions) error
	// RunOneOffContainer creates a service oneoff container and starts its dependencies
	RunOneOffContainer(ctx context.Context, project *types.Project, opts RunOptions) (int, error)
	// Remove executes the equivalent to a `compose rm`
	Remove(ctx context.Context, projectName string, options RemoveOptions) error
	// Exec executes a command in a running service container
	Exec(ctx context.Context, projectName string, options RunOptions) (int, error)
	// Attach STDIN,STDOUT,STDERR to a running service container
	Attach(ctx context.Context, projectName string, options AttachOptions) error
	// Copy copies a file/folder between a service container and the local filesystem
	Copy(ctx context.Context, projectName string, options CopyOptions) error
	// Pause executes the equivalent to a `compose pause`
	Pause(ctx context.Context, projectName string, options PauseOptions) error
	// UnPause executes the equivalent to a `compose unpause`
	UnPause(ctx context.Context, projectName string, options PauseOptions) error
	// Top executes the equivalent to a `compose top`
	Top(ctx context.Context, projectName string, services []string) ([]ContainerProcSummary, error)
	// Events executes the equivalent to a `compose events`
	Events(ctx context.Context, projectName string, options EventsOptions) error
	// Port executes the equivalent to a `compose port`
	Port(ctx context.Context, projectName string, service string, port uint16, options PortOptions) (string, int, error)
	// Publish executes the equivalent to a `compose publish`
	Publish(ctx context.Context, project *types.Project, repository string, options PublishOptions) error
	// Images executes the equivalent of a `compose images`
	Images(ctx context.Context, projectName string, options ImagesOptions) ([]ImageSummary, error)
	// MaxConcurrency defines upper limit for concurrent operations against engine API
	MaxConcurrency(parallel int)
	// DryRunMode defines if dry run applies to the command
	DryRunMode(ctx context.Context, dryRun bool) (context.Context, error)
	// Watch services' development context and sync/notify/rebuild/restart on changes
	Watch(ctx context.Context, project *types.Project, services []string, options WatchOptions) error
	// Viz generates a graphviz graph of the project services
	Viz(ctx context.Context, project *types.Project, options VizOptions) (string, error)
	// Wait blocks until at least one of the services' container exits
	Wait(ctx context.Context, projectName string, options WaitOptions) (int64, error)
	// Scale manages numbers of container instances running per service
	Scale(ctx context.Context, project *types.Project, options ScaleOptions) error
}

Service manages a compose project

type ServiceStatus

type ServiceStatus struct {
	ID         string
	Name       string
	Replicas   int
	Desired    int
	Ports      []string
	Publishers []PortPublisher
}

ServiceStatus hold status about a service

type Stack

type Stack struct {
	ID          string
	Name        string
	Status      string
	ConfigFiles string
	Reason      string
}

Stack holds the name and state of a compose application/stack

type StartOptions

type StartOptions struct {
	// Project is the compose project used to define this app. Might be nil if user ran command just with project name
	Project *types.Project
	// Attach to container and forward logs if not nil
	Attach LogConsumer
	// AttachTo set the services to attach to
	AttachTo []string
	// OnExit defines behavior when a container stops
	OnExit Cascade
	// ExitCodeFrom return exit code from specified service
	ExitCodeFrom string
	// Wait won't return until containers reached the running|healthy state
	Wait        bool
	WaitTimeout time.Duration
	// Services passed in the command line to be started
	Services       []string
	Watch          bool
	NavigationMenu bool
}

StartOptions group options of the Start API

type StopOptions

type StopOptions struct {
	// Project is the compose project used to define this app. Might be nil if user ran command just with project name
	Project *types.Project
	// Timeout override container stop timeout
	Timeout *time.Duration
	// Services passed in the command line to be stopped
	Services []string
}

StopOptions group options of the Stop API

type Streams added in v2.15.0

type Streams interface {
	Out() *streams.Out
	Err() io.Writer
	In() *streams.In
}

type UpOptions

type UpOptions struct {
	Create CreateOptions
	Start  StartOptions
}

UpOptions group options of the Up API

type VizOptions added in v2.18.0

type VizOptions struct {
	// IncludeNetworks if true, network names a container is attached to should appear in the graph node
	IncludeNetworks bool
	// IncludePorts if true, ports a container exposes should appear in the graph node
	IncludePorts bool
	// IncludeImageName if true, name of the image used to create a container should appear in the graph node
	IncludeImageName bool
	// Indentation string to be used to indent graphviz code, e.g. "\t", "    "
	Indentation string
}

type WaitOptions added in v2.20.0

type WaitOptions struct {
	// Services passed in the command line to be waited
	Services []string
	// Executes a down when a container exits
	DownProjectOnContainerExit bool
}

type WatchOptions added in v2.16.0

type WatchOptions struct {
	Build *BuildOptions
	LogTo LogConsumer
}

WatchOptions group options of the Watch API

Jump to

Keyboard shortcuts

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