api

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

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
	// ContainerEventStarted let consumer know a container has been started
	ContainerEventStarted
	// ContainerEventRestarted let consumer know a container has been restarted
	ContainerEventRestarted
	// ContainerEventStopped is a ContainerEvent of type stopped.
	ContainerEventStopped
	// ContainerEventCreated let consumer know a new container has been created
	ContainerEventCreated
	// ContainerEventRecreated let consumer know container stopped but his being replaced
	ContainerEventRecreated
	// ContainerEventExited is a ContainerEvent of type exit. ExitCode is set
	ContainerEventExited
	// UserCancel user canceled compose up, we are stopping containers
	HookEventLog
)
View Source
const (
	StatusError            = "Error"
	StatusCreating         = "Creating"
	StatusStarting         = "Starting"
	StatusStarted          = "Started"
	StatusWaiting          = "Waiting"
	StatusHealthy          = "Healthy"
	StatusExited           = "Exited"
	StatusRestarting       = "Restarting"
	StatusRestarted        = "Restarted"
	StatusRunning          = "Running"
	StatusCreated          = "Created"
	StatusStopping         = "Stopping"
	StatusStopped          = "Stopped"
	StatusKilling          = "Killing"
	StatusKilled           = "Killed"
	StatusRemoving         = "Removing"
	StatusRemoved          = "Removed"
	StatusBuilding         = "Building"
	StatusBuilt            = "Built"
	StatusPulling          = "Pulling"
	StatusPulled           = "Pulled"
	StatusCommitting       = "Committing"
	StatusCommitted        = "Committed"
	StatusCopying          = "Copying"
	StatusCopied           = "Copied"
	StatusExporting        = "Exporting"
	StatusExported         = "Exported"
	StatusDownloading      = "Downloading"
	StatusDownloadComplete = "Download complete"
	StatusConfiguring      = "Configuring"
	StatusConfigured       = "Configured"
)
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 ComposeCompatibility = "COMPOSE_COMPATIBILITY"

ComposeCompatibility try to mimic compose v1 as much as possible

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 ResourceCompose = "Compose"

ResourceCompose is a special resource ID used when event applies to all resources in the application

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")
	// 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")
	// ErrNoResources is returned when operation didn't selected any resource
	ErrNoResources = errors.New("no resources")
)
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

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

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
	// Print don't actually run builder but print equivalent build config
	Print bool
	// Check let builder validate build configuration
	Check bool
	// Attestations allows to enable attestations generation
	Attestations bool
	// Provenance generate a provenance attestation
	Provenance string
	// SBOM generate a SBOM attestation
	SBOM string
	// Out is the stream to write build progress
	Out io.Writer
}

BuildOptions group options of the Build API

func (BuildOptions) Apply

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

Apply mutates project according to build options

type Cascade

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

type CommitOptions

type CommitOptions struct {
	Service   string
	Reference string

	Pause   bool
	Comment string
	Author  string
	Changes opts.ListOpts

	Index int
}

CommitOptions group options of the Commit API

type Compose

type Compose 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) (map[string]ImageSummary, error)
	// Watch services' development context and sync/notify/rebuild/restart on changes
	Watch(ctx context.Context, project *types.Project, 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
	// Export a service container's filesystem as a tar archive
	Export(ctx context.Context, projectName string, options ExportOptions) error
	// Create a new image from a service container's changes
	Commit(ctx context.Context, projectName string, options CommitOptions) error
	// Generate generates a Compose Project from existing containers
	Generate(ctx context.Context, options GenerateOptions) (*types.Project, error)
	// Volumes executes the equivalent to a `docker volume ls`
	Volumes(ctx context.Context, project string, options VolumesOptions) ([]VolumesSummary, error)
	// LoadProject loads and validates a Compose project from configuration files.
	LoadProject(ctx context.Context, options ProjectLoadOptions) (*types.Project, error)
}

Compose is the API interface one can use to programmatically use docker/compose in a third-party software Use [compose.NewComposeService] to get an actual instance

type ConfigOptions

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
	Time      int64
	Container *ContainerSummary
	// Source 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.
	Source  string
	ID      string
	Service string
	Line    string
	// ExitCode is only set on ContainerEventExited events
	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
	Service   string
	Replica   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 ContextInfo

type ContextInfo interface {
	// CurrentContext returns the name of the current Docker context
	// Returns "default" for simple clients without context support
	CurrentContext() string

	// ServerOSType returns the Docker daemon's operating system (linux/windows/darwin)
	// Used for OS-specific compatibility checks
	ServerOSType() string

	// BuildKitEnabled determines whether BuildKit should be used for builds
	// Checks DOCKER_BUILDKIT env var, config, and daemon capabilities
	BuildKitEnabled() (bool, error)
}

ContextInfo provides Docker context information for advanced scenarios

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 gracefully 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 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 EventProcessor

type EventProcessor interface {
	// Start is triggered as a Compose operation is starting with context
	Start(ctx context.Context, operation string)
	// On notify about (sub)task and progress processing operation
	On(events ...Resource)
	// Done is triggered as a Compose operation completed
	Done(operation string, success bool)
}

EventProcessor is notified about Compose operations and tasks

type EventStatus

type EventStatus int

EventStatus indicates the status of an action

const (
	// Working means that the current task is working
	Working EventStatus = iota
	// Done means that the current task is done
	Done
	// Warning means that the current task has warning
	Warning
	// Error means that the current task has errored
	Error
)

type EventsOptions

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

EventsOptions group options of the Events API

type ExportOptions

type ExportOptions struct {
	Service string
	Index   int
	Output  string
}

ExportOptions group options of the Export API

type GenerateOptions

type GenerateOptions struct {
	// ProjectName to set in the Compose file
	ProjectName string
	// Containers passed in the command line to be used as reference for service definition
	Containers []string
}

type ImageSummary

type ImageSummary struct {
	ID          string
	Repository  string
	Tag         string
	Platform    platforms.Platform
	Size        int64
	Created     *time.Time
	LastTagTime time.Time
}

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 LoadListener

type LoadListener func(event string, metadata map[string]any)

LoadListener receives events during project loading. Events include:

  • "extends": when a service extends another (metadata: service info)
  • "include": when including external compose files (metadata: {"path": StringList})

Multiple listeners can be registered, and all will be notified of events.

type LogConsumer

type LogConsumer interface {
	Log(containerName, message string)
	Err(containerName, message string)
	Status(container, msg 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 OCIOptions

type OCIOptions struct {
	InsecureRegistries []string
}

type OCIVersion

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 ProjectLoadOptions

type ProjectLoadOptions struct {
	// ProjectName to use, or empty to infer from directory
	ProjectName string
	// ConfigPaths are paths to compose files
	ConfigPaths []string
	// WorkingDir is the project directory
	WorkingDir string
	// EnvFiles are paths to .env files
	EnvFiles []string
	// Profiles to activate
	Profiles []string
	// Services to select (empty = all)
	Services []string
	// Offline mode disables remote resource loading
	Offline bool
	// All includes all resources (not just those used by services)
	All bool
	// Compatibility enables v1 compatibility mode
	Compatibility bool

	// ProjectOptionsFns are compose-go project options to apply.
	// Use cli.WithInterpolation(false), cli.WithNormalization(false), etc.
	// This is optional - pass nil or empty slice to use defaults.
	ProjectOptionsFns []cli.ProjectOptionsFn

	// LoadListeners receive events during project loading.
	// All registered listeners will be notified of events.
	// This is optional - pass nil or empty slice if not needed.
	LoadListeners []LoadListener

	OCI OCIOptions
}

ProjectLoadOptions configures how a Compose project should be loaded

type PsOptions

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

PsOptions group options of the Ps API

type PublishOptions

type PublishOptions struct {
	ResolveImageDigests bool
	Application         bool
	WithEnvironment     bool
	OCIVersion          OCIVersion
	// Use plain HTTP to access registry. Should only be used for testing purpose
	InsecureRegistry bool
}

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
	ImageMandatory 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 Resource

type Resource struct {
	ID       string
	ParentID string
	Text     string
	Details  string
	Status   EventStatus
	Current  int64
	Percent  int
	Total    int64
}

Resource represents status change and progress for a compose resource.

func (*Resource) StatusText

func (e *Resource) StatusText() string

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 {
	CreateOptions
	// 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
	// used by exec
	Index int
}

RunOptions group options of the Run API

type ScaleOptions

type ScaleOptions struct {
	Services []string
}

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 UpOptions

type UpOptions struct {
	Create CreateOptions
	Start  StartOptions
}

UpOptions group options of the Up API

type VizOptions

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 VolumesOptions

type VolumesOptions struct {
	Services []string
}

type VolumesSummary

type VolumesSummary = *volume.Volume

type WaitOptions

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

type WatchOptions struct {
	Build    *BuildOptions
	LogTo    LogConsumer
	Prune    bool
	Services []string
}

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