Documentation ¶
Index ¶
- Constants
- type BuildOptions
- type ContainerEvent
- type ContainerEventListener
- type ContainerProcSummary
- type ContainerSummary
- type ConvertOptions
- type CopyOptions
- type CreateOptions
- type DownOptions
- type Event
- type EventsOptions
- type ImageSummary
- type ImagesOptions
- type KillOptions
- type ListOptions
- type LogConsumer
- type LogOptions
- type NoImpl
- func (s NoImpl) Build(ctx context.Context, project *types.Project, options BuildOptions) error
- func (s NoImpl) Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error)
- func (s NoImpl) Copy(ctx context.Context, project *types.Project, opts CopyOptions) error
- func (s NoImpl) Create(ctx context.Context, project *types.Project, options CreateOptions) error
- func (s NoImpl) Down(ctx context.Context, project string, options DownOptions) error
- func (s NoImpl) Events(ctx context.Context, project string, options EventsOptions) error
- func (s NoImpl) Exec(ctx context.Context, project *types.Project, opts RunOptions) (int, error)
- func (s NoImpl) Images(ctx context.Context, project string, options ImagesOptions) ([]ImageSummary, error)
- func (s NoImpl) Kill(ctx context.Context, project *types.Project, options KillOptions) error
- func (s NoImpl) List(ctx context.Context, options ListOptions) ([]Stack, error)
- func (s NoImpl) Logs(ctx context.Context, project string, consumer LogConsumer, options LogOptions) error
- func (s NoImpl) Pause(ctx context.Context, project string, options PauseOptions) error
- func (s NoImpl) Port(ctx context.Context, project string, service string, port int, ...) (string, int, error)
- func (s NoImpl) Ps(ctx context.Context, project string, options PsOptions) ([]ContainerSummary, error)
- func (s NoImpl) Pull(ctx context.Context, project *types.Project, options PullOptions) error
- func (s NoImpl) Push(ctx context.Context, project *types.Project, options PushOptions) error
- func (s NoImpl) Remove(ctx context.Context, project *types.Project, options RemoveOptions) ([]string, error)
- func (s NoImpl) Restart(ctx context.Context, project *types.Project, options RestartOptions) error
- func (s NoImpl) RunOneOffContainer(ctx context.Context, project *types.Project, options RunOptions) (int, error)
- func (s NoImpl) Start(ctx context.Context, project *types.Project, options StartOptions) error
- func (s NoImpl) Stop(ctx context.Context, project *types.Project, options StopOptions) error
- func (s NoImpl) Top(ctx context.Context, project string, services []string) ([]ContainerProcSummary, error)
- func (s NoImpl) UnPause(ctx context.Context, project string, options PauseOptions) error
- func (s NoImpl) Up(ctx context.Context, project *types.Project, options UpOptions) error
- type PauseOptions
- type PortOptions
- type PortPublisher
- type PsOptions
- type PullOptions
- type PushOptions
- type RemoveOptions
- type RestartOptions
- type RunOptions
- type Service
- type ServiceDelegator
- func (s *ServiceDelegator) Build(ctx context.Context, project *types.Project, options BuildOptions) error
- func (s *ServiceDelegator) Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error)
- func (s *ServiceDelegator) Copy(ctx context.Context, project *types.Project, options CopyOptions) error
- func (s *ServiceDelegator) Create(ctx context.Context, project *types.Project, options CreateOptions) error
- func (s *ServiceDelegator) Down(ctx context.Context, project string, options DownOptions) error
- func (s *ServiceDelegator) Events(ctx context.Context, project string, options EventsOptions) error
- func (s *ServiceDelegator) Exec(ctx context.Context, project *types.Project, options RunOptions) (int, error)
- func (s *ServiceDelegator) Images(ctx context.Context, project string, options ImagesOptions) ([]ImageSummary, error)
- func (s *ServiceDelegator) Kill(ctx context.Context, project *types.Project, options KillOptions) error
- func (s *ServiceDelegator) List(ctx context.Context, options ListOptions) ([]Stack, error)
- func (s *ServiceDelegator) Logs(ctx context.Context, project string, consumer LogConsumer, options LogOptions) error
- func (s *ServiceDelegator) Pause(ctx context.Context, project string, options PauseOptions) error
- func (s *ServiceDelegator) Port(ctx context.Context, project string, service string, port int, ...) (string, int, error)
- func (s *ServiceDelegator) Ps(ctx context.Context, project string, options PsOptions) ([]ContainerSummary, error)
- func (s *ServiceDelegator) Pull(ctx context.Context, project *types.Project, options PullOptions) error
- func (s *ServiceDelegator) Push(ctx context.Context, project *types.Project, options PushOptions) error
- func (s *ServiceDelegator) Remove(ctx context.Context, project *types.Project, options RemoveOptions) ([]string, error)
- func (s *ServiceDelegator) Restart(ctx context.Context, project *types.Project, options RestartOptions) error
- func (s *ServiceDelegator) RunOneOffContainer(ctx context.Context, project *types.Project, options RunOptions) (int, error)
- func (s *ServiceDelegator) Start(ctx context.Context, project *types.Project, options StartOptions) error
- func (s *ServiceDelegator) Stop(ctx context.Context, project *types.Project, options StopOptions) error
- func (s *ServiceDelegator) Top(ctx context.Context, project string, services []string) ([]ContainerProcSummary, error)
- func (s *ServiceDelegator) UnPause(ctx context.Context, project string, options PauseOptions) error
- func (s *ServiceDelegator) Up(ctx context.Context, project *types.Project, options UpOptions) error
- type ServiceStatus
- type Stack
- type StartOptions
- type StopOptions
- type UpOptions
Constants ¶
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" )
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" )
const ( // ContainerEventLog is a ContainerEvent of type log. Line is set ContainerEventLog = iota // ContainerEventAttach is a ContainerEvent of type attach. First event sent about a container ContainerEventAttach // ContainerEventExit is a ContainerEvent of type exit. ExitCode is set ContainerEventExit // UserCancel user cancelled compose up, we are stopping containers UserCancel )
const ( // ProjectTag allow to track resource related to a compose project ProjectTag = "com.docker.compose.project" // NetworkTag allow to track resource related to a compose network NetworkTag = "com.docker.compose.network" // ServiceTag allow to track resource related to a compose service ServiceTag = "com.docker.compose.service" // VolumeTag allow to track resource related to a compose volume VolumeTag = "com.docker.compose.volume" // EnvironmentFileLabel is set in containers with the option "--env-file" when set EnvironmentFileLabel = "com.docker.compose.project.environment_file" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildOptions ¶ added in v1.0.10
type BuildOptions struct { // Pull always attempt to pull a newer version of the image Pull 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 }
BuildOptions group options of the Build API
type ContainerEvent ¶ added in v1.0.9
ContainerEvent notify an event has been collected on source container implementing Service
type ContainerEventListener ¶ added in v1.0.9
type ContainerEventListener func(event ContainerEvent)
ContainerEventListener is a callback to process ContainerEvent from services
type ContainerProcSummary ¶ added in v1.0.10
ContainerProcSummary holds container processes top data
type ContainerSummary ¶ added in v1.0.5
type ContainerSummary struct { ID string Name string Project string Service string State string Health string Publishers []PortPublisher }
ContainerSummary hold high-level description of a container
type ConvertOptions ¶ added in v1.0.6
type ConvertOptions 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 }
ConvertOptions group options of the Convert API
type CopyOptions ¶ added in v1.0.15
type CopyOptions struct { Source string Destination string All bool Index int FollowLink bool CopyUIDGID bool }
CopyOptions group options of the cp API
type CreateOptions ¶ added in v1.0.7
type CreateOptions struct { // Services defines the services user interacts with Services []string // Remove legacy containers for services that are not defined in the project RemoveOrphans 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 ¶ added in v1.0.6
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 }
DownOptions group options of the Down API
type Event ¶ added in v1.0.10
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
type EventsOptions ¶ added in v1.0.10
EventsOptions group options of the Events API
type ImageSummary ¶ added in v1.0.13
ImageSummary holds container image description
type ImagesOptions ¶ added in v1.0.13
type ImagesOptions struct {
Services []string
}
ImagesOptions group options of the Images API
type KillOptions ¶ added in v1.0.8
type KillOptions struct { // Signal to send to containers Signal string }
KillOptions group options of the Kill API
type ListOptions ¶ added in v1.0.9
type ListOptions struct {
All bool
}
ListOptions group options of the ls API
type LogConsumer ¶ added in v1.0.4
type LogConsumer interface { Log(service, container, message string) Status(container, msg string) Register(container string) }
LogConsumer is a callback to process log messages from services
type LogOptions ¶ added in v1.0.6
LogOptions defines optional parameters for the `Log` API
type NoImpl ¶ added in v1.0.14
type NoImpl struct{}
NoImpl implements Service to return ErrNotImplemented
func (NoImpl) Convert ¶ added in v1.0.14
func (s NoImpl) Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error)
Convert implements Service interface
func (NoImpl) Images ¶ added in v1.0.14
func (s NoImpl) Images(ctx context.Context, project string, options ImagesOptions) ([]ImageSummary, error)
Images implements Service interface
func (NoImpl) Logs ¶ added in v1.0.14
func (s NoImpl) Logs(ctx context.Context, project string, consumer LogConsumer, options LogOptions) error
Logs implements Service interface
func (NoImpl) Port ¶ added in v1.0.14
func (s NoImpl) Port(ctx context.Context, project string, service string, port int, options PortOptions) (string, int, error)
Port implements Service interface
func (NoImpl) Ps ¶ added in v1.0.14
func (s NoImpl) Ps(ctx context.Context, project string, options PsOptions) ([]ContainerSummary, error)
Ps implements Service interface
func (NoImpl) Remove ¶ added in v1.0.14
func (s NoImpl) Remove(ctx context.Context, project *types.Project, options RemoveOptions) ([]string, error)
Remove implements Service interface
func (NoImpl) RunOneOffContainer ¶ added in v1.0.14
func (s NoImpl) RunOneOffContainer(ctx context.Context, project *types.Project, options RunOptions) (int, error)
RunOneOffContainer implements Service interface
func (NoImpl) Top ¶ added in v1.0.14
func (s NoImpl) Top(ctx context.Context, project string, services []string) ([]ContainerProcSummary, error)
Top implements Service interface
type PauseOptions ¶ added in v1.0.13
type PauseOptions struct { // Services passed in the command line to be started Services []string }
PauseOptions group options of the Pause API
type PortOptions ¶ added in v1.0.11
PortOptions group options of the Port API
type PortPublisher ¶
PortPublisher hold status about published port
type PullOptions ¶ added in v1.0.11
type PullOptions struct {
IgnoreFailures bool
}
PullOptions group options of the Push API
type PushOptions ¶ added in v1.0.10
type PushOptions struct {
IgnoreFailures bool
}
PushOptions group options of the Push API
type RemoveOptions ¶ added in v1.0.9
type RemoveOptions struct { // DryRun just list removable resources DryRun 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 ¶ added in v1.0.11
RestartOptions group options of the Restart API
type RunOptions ¶ added in v1.0.6
type RunOptions struct { Name string Service string Command []string Entrypoint []string Detach bool AutoRemove bool Writer io.WriteCloser Reader io.ReadCloser Tty bool WorkingDir string User string Environment []string Labels types.Labels Privileged bool UseNetworkAliases bool // used by exec Index int }
RunOptions group options of the Run API
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 ot 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, opts PullOptions) error // Create executes the equivalent to a `compose create` Create(ctx context.Context, project *types.Project, opts CreateOptions) error // Start executes the equivalent to a `compose start` Start(ctx context.Context, project *types.Project, options StartOptions) error // Restart restarts containers Restart(ctx context.Context, project *types.Project, options RestartOptions) error // Stop executes the equivalent to a `compose stop` Stop(ctx context.Context, project *types.Project, 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) // Convert translate compose model into backend's native format Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error) // Kill executes the equivalent to a `compose kill` Kill(ctx context.Context, project *types.Project, 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, project *types.Project, options RemoveOptions) ([]string, error) // Exec executes a command in a running service container Exec(ctx context.Context, project *types.Project, opts RunOptions) (int, error) // Copy copies a file/folder between a service container and the local filesystem Copy(ctx context.Context, project *types.Project, opts CopyOptions) error // Pause executes the equivalent to a `compose pause` Pause(ctx context.Context, project string, options PauseOptions) error // UnPause executes the equivalent to a `compose unpause` UnPause(ctx context.Context, project 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, project string, options EventsOptions) error // Port executes the equivalent to a `compose port` Port(ctx context.Context, project string, service string, port int, options PortOptions) (string, int, error) // Images executes the equivalent of a `compose images` Images(ctx context.Context, projectName string, options ImagesOptions) ([]ImageSummary, error) }
Service manages a compose project
type ServiceDelegator ¶ added in v1.0.14
type ServiceDelegator struct {
Delegate Service
}
ServiceDelegator implements Service by delegating to another implementation. This allows lazy init
func (*ServiceDelegator) Build ¶ added in v1.0.14
func (s *ServiceDelegator) Build(ctx context.Context, project *types.Project, options BuildOptions) error
Build implements Service interface
func (*ServiceDelegator) Convert ¶ added in v1.0.14
func (s *ServiceDelegator) Convert(ctx context.Context, project *types.Project, options ConvertOptions) ([]byte, error)
Convert implements Service interface
func (*ServiceDelegator) Copy ¶ added in v1.0.15
func (s *ServiceDelegator) Copy(ctx context.Context, project *types.Project, options CopyOptions) error
Copy implements Service interface
func (*ServiceDelegator) Create ¶ added in v1.0.14
func (s *ServiceDelegator) Create(ctx context.Context, project *types.Project, options CreateOptions) error
Create implements Service interface
func (*ServiceDelegator) Down ¶ added in v1.0.14
func (s *ServiceDelegator) Down(ctx context.Context, project string, options DownOptions) error
Down implements Service interface
func (*ServiceDelegator) Events ¶ added in v1.0.14
func (s *ServiceDelegator) Events(ctx context.Context, project string, options EventsOptions) error
Events implements Service interface
func (*ServiceDelegator) Exec ¶ added in v1.0.14
func (s *ServiceDelegator) Exec(ctx context.Context, project *types.Project, options RunOptions) (int, error)
Exec implements Service interface
func (*ServiceDelegator) Images ¶ added in v1.0.14
func (s *ServiceDelegator) Images(ctx context.Context, project string, options ImagesOptions) ([]ImageSummary, error)
Images implements Service interface
func (*ServiceDelegator) Kill ¶ added in v1.0.14
func (s *ServiceDelegator) Kill(ctx context.Context, project *types.Project, options KillOptions) error
Kill implements Service interface
func (*ServiceDelegator) List ¶ added in v1.0.14
func (s *ServiceDelegator) List(ctx context.Context, options ListOptions) ([]Stack, error)
List implements Service interface
func (*ServiceDelegator) Logs ¶ added in v1.0.14
func (s *ServiceDelegator) Logs(ctx context.Context, project string, consumer LogConsumer, options LogOptions) error
Logs implements Service interface
func (*ServiceDelegator) Pause ¶ added in v1.0.14
func (s *ServiceDelegator) Pause(ctx context.Context, project string, options PauseOptions) error
Pause implements Service interface
func (*ServiceDelegator) Port ¶ added in v1.0.14
func (s *ServiceDelegator) Port(ctx context.Context, project string, service string, port int, options PortOptions) (string, int, error)
Port implements Service interface
func (*ServiceDelegator) Ps ¶ added in v1.0.14
func (s *ServiceDelegator) Ps(ctx context.Context, project string, options PsOptions) ([]ContainerSummary, error)
Ps implements Service interface
func (*ServiceDelegator) Pull ¶ added in v1.0.14
func (s *ServiceDelegator) Pull(ctx context.Context, project *types.Project, options PullOptions) error
Pull implements Service interface
func (*ServiceDelegator) Push ¶ added in v1.0.14
func (s *ServiceDelegator) Push(ctx context.Context, project *types.Project, options PushOptions) error
Push implements Service interface
func (*ServiceDelegator) Remove ¶ added in v1.0.14
func (s *ServiceDelegator) Remove(ctx context.Context, project *types.Project, options RemoveOptions) ([]string, error)
Remove implements Service interface
func (*ServiceDelegator) Restart ¶ added in v1.0.14
func (s *ServiceDelegator) Restart(ctx context.Context, project *types.Project, options RestartOptions) error
Restart implements Service interface
func (*ServiceDelegator) RunOneOffContainer ¶ added in v1.0.14
func (s *ServiceDelegator) RunOneOffContainer(ctx context.Context, project *types.Project, options RunOptions) (int, error)
RunOneOffContainer implements Service interface
func (*ServiceDelegator) Start ¶ added in v1.0.14
func (s *ServiceDelegator) Start(ctx context.Context, project *types.Project, options StartOptions) error
Start implements Service interface
func (*ServiceDelegator) Stop ¶ added in v1.0.14
func (s *ServiceDelegator) Stop(ctx context.Context, project *types.Project, options StopOptions) error
Stop implements Service interface
func (*ServiceDelegator) Top ¶ added in v1.0.14
func (s *ServiceDelegator) Top(ctx context.Context, project string, services []string) ([]ContainerProcSummary, error)
Top implements Service interface
func (*ServiceDelegator) UnPause ¶ added in v1.0.14
func (s *ServiceDelegator) UnPause(ctx context.Context, project string, options PauseOptions) error
UnPause implements Service interface
type ServiceStatus ¶
type ServiceStatus struct { ID string Name string Replicas int Desired int Ports []string Publishers []PortPublisher }
ServiceStatus hold status about a service
type StartOptions ¶ added in v1.0.9
type StartOptions struct { // Attach will attach to service containers and send container logs and events Attach ContainerEventListener // Services passed in the command line to be started Services []string }
StartOptions group options of the Start API
type StopOptions ¶ added in v1.0.9
type StopOptions struct { // 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