compose

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

package compose is a wrapper around the docker compose cli. it provides a programmatic interface for managing docker compose projects. it is not a complete 1:1 mapping of the docker compose cli, but provides a programmatic interface for managing docker compose projects in Go, making it useful for automation, tooling, or embedding docker compose behavior.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrComposeError       = fmt.Errorf("compose error")
	ErrComposeFlagError   = fmt.Errorf("compose flag error")
	ErrComposeUpError     = fmt.Errorf("compose up error")
	ErrComposeDownError   = fmt.Errorf("compose down error")
	ErrComposeLogsError   = fmt.Errorf("compose logs error")
	ErrComposeKillError   = fmt.Errorf("compose kill error")
	ErrComposeEventsError = fmt.Errorf("compose events error")
)

Errors for the compose command and its setters.

Functions

func IsComposeDownError

func IsComposeDownError(err error) bool

IsComposeDownError checks if the error is a ComposeDownError.

func IsComposeError

func IsComposeError(err error) bool

IsComposeError checks if the error is a ComposeError.

func IsComposeEventsError added in v0.1.7

func IsComposeEventsError(err error) bool

IsComposeEventsError checks if the error is a ComposeEventsError.

func IsComposeFlagError

func IsComposeFlagError(err error) bool

IsComposeFlagError checks if the error is a ComposeFlagError.

func IsComposeKillError added in v0.1.7

func IsComposeKillError(err error) bool

IsComposeKillError checks if the error is a ComposeKillError.

func IsComposeLogsError

func IsComposeLogsError(err error) bool

IsComposeLogsError checks if the error is a ComposeLogsError.

func IsComposeUpError

func IsComposeUpError(err error) bool

IsComposeUpError checks if the error is a ComposeUpError.

func NewCompose

func NewCompose(project *create.Project) *compose

Types

type ComposeDownError

type ComposeDownError struct {
	Message string
}

ComposeDownError is the error for the compose down command

func NewComposeDownError

func NewComposeDownError(err error) *ComposeDownError

NewComposeDownError creates a new ComposeDownError with the given error message.

func (*ComposeDownError) Error

func (e *ComposeDownError) Error() string

func (*ComposeDownError) Unwrap

func (e *ComposeDownError) Unwrap() error

type ComposeDownOptions

type ComposeDownOptions struct {
	RemoveOrphans bool
	Timeout       *int
	RemoveImage   *string
	RemoveVolumes bool

	Flags    []string
	Writer   io.Writer
	Profiles []string
}

ComposeDownOptions is the options for the compose down command

func (*ComposeDownOptions) GenerateFlags

func (opt *ComposeDownOptions) GenerateFlags() ([]string, error)

type ComposeError

type ComposeError struct {
	Message string
}

ComposeError is the error for the compose command

func NewComposeError

func NewComposeError(err error) *ComposeError

func (*ComposeError) Error

func (e *ComposeError) Error() string

func (*ComposeError) Unwrap

func (e *ComposeError) Unwrap() error

type ComposeEventsError added in v0.1.7

type ComposeEventsError struct {
	Message string
}

ComposeEventsError is the error for the compose events command

func NewComposeEventsError added in v0.1.7

func NewComposeEventsError(err error) *ComposeEventsError

NewComposeEventsError creates a new ComposeEventsError with the given error message.

func (*ComposeEventsError) Error added in v0.1.7

func (e *ComposeEventsError) Error() string

func (*ComposeEventsError) Unwrap added in v0.1.7

func (e *ComposeEventsError) Unwrap() error

type ComposeFlagError

type ComposeFlagError struct {
	Flag    string
	Message string
}

ComposeFlagError is the error for the compose flag

func NewComposeFlagError

func NewComposeFlagError(flag, message string) *ComposeFlagError

NewComposeFlagError makes a new ComposeFlagError with the given flag and message.

func (*ComposeFlagError) Error

func (e *ComposeFlagError) Error() string

func (*ComposeFlagError) Unwrap

func (e *ComposeFlagError) Unwrap() error

type ComposeKillError added in v0.1.7

type ComposeKillError struct {
	Message string
}

ComposeKillError is the error for the compose kill command

func NewComposeKillError added in v0.1.7

func NewComposeKillError(err error) *ComposeKillError

NewComposeKillError creates a new ComposeKillError with the given error message.

func (*ComposeKillError) Error added in v0.1.7

func (e *ComposeKillError) Error() string

func (*ComposeKillError) Unwrap added in v0.1.7

func (e *ComposeKillError) Unwrap() error

type ComposeKillOptions added in v0.1.7

type ComposeKillOptions struct {
	Signal        *string
	RemoveOrphans bool

	Flags    []string
	Writer   io.Writer
	Profiles []string
}

ComposeKillOptions is the options for the compose kill command

func (*ComposeKillOptions) GenerateFlags added in v0.1.7

func (opt *ComposeKillOptions) GenerateFlags() ([]string, error)

GenerateFlags generates the flags for the compose kill command

It will return a slice of flags to append to the command Eg.

[]string{"kill", "--signal", "SIGKILL", "--remove-orphans"}

type ComposeLogsError

type ComposeLogsError struct {
	Message string
}

ComposeLogsError is the error for the compose logs command

func NewComposeLogsError

func NewComposeLogsError(err error) *ComposeLogsError

NewComposeLogsError creates a new ComposeLogsError with the given error message.

func (*ComposeLogsError) Error

func (e *ComposeLogsError) Error() string

func (*ComposeLogsError) Unwrap

func (e *ComposeLogsError) Unwrap() error

type ComposeLogsOptions

type ComposeLogsOptions struct {
	Tail        *int
	Follow      bool
	NoLogPrefix bool

	Writer   io.Writer
	Flags    []string
	Profiles []string
}

ComposeLogsOptions is the options for the compose logs command

func (*ComposeLogsOptions) GenerateFlags

func (opt *ComposeLogsOptions) GenerateFlags() ([]string, error)

type ComposeUpError

type ComposeUpError struct {
	Message string
}

ComposeUpError is the error for the compose up command

func NewComposeUpError

func NewComposeUpError(err error) *ComposeUpError

NewComposeUpError creates a new ComposeUpError with the given error message.

func (*ComposeUpError) Error

func (e *ComposeUpError) Error() string

func (*ComposeUpError) Unwrap

func (e *ComposeUpError) Unwrap() error

type ComposeUpOptions

type ComposeUpOptions struct {
	Detach                  bool
	AbortOnContainerExit    bool
	AbortOnContainerFailure bool
	AlwaysRecreateDeps      bool
	Attach                  *string
	AttachDependencies      bool
	Build                   bool
	NoBuild                 bool
	ForceRecreate           bool
	Menu                    bool
	ExitCodeFrom            *string
	NoAttach                *string
	NoColor                 bool
	NoDeps                  bool
	NoLogPrefix             bool
	NoRecreate              bool
	Pull                    *string
	NoStart                 bool
	QuietPull               bool
	RemoveOrphans           bool
	RenewAnonVolumes        bool
	Scale                   []ComposeUpScale
	Timeout                 *int
	Timestamps              bool
	Wait                    bool
	WaitTimeout             *int
	Watch                   bool
	Yes                     bool

	Profiles []string
	Flags    []string
	Writer   io.Writer
	Errs     []error
}

ComposeUpOptions is the options for the compose up command

func (*ComposeUpOptions) GenerateFlags

func (opt *ComposeUpOptions) GenerateFlags() (flags []string, err error)

GenerateFlags generates the flags for the compose up command

It will return a slice of flags to append to the command Eg.

[]string{"up", "--detach", ...}

type ComposeUpScale

type ComposeUpScale struct {
	Service string
	Num     int
}

ComposeUpScale is the scale for the compose up command

type Events added in v0.1.7

type Events struct {
	// Core event fields
	Time    string `json:"time"`
	Type    string `json:"type"`
	Action  string `json:"action"`
	ID      string `json:"id"`
	Service string `json:"service"`
	// Attributes map containing event-specific information
	Attributes map[string]string `json:"attributes"`

	// Additional fields that may be present in some events
	Scope  string `json:"scope,omitempty"`
	Status string `json:"status,omitempty"`
	From   string `json:"from,omitempty"`
}

type SetComposeDownOption

type SetComposeDownOption func(*ComposeDownOptions) error

SetComposeDownOption is a function that sets a ComposeDownOptions

type SetComposeKillOption added in v0.1.7

type SetComposeKillOption func(*ComposeKillOptions) error

SetComposeKillOption is a function that sets a ComposeKillOptions

type SetComposeLogsOption

type SetComposeLogsOption func(*ComposeLogsOptions) error

SetComposeLogsOption is a function that sets a ComposeLogsOptions

type SetComposeUpOption

type SetComposeUpOption func(*ComposeUpOptions) error

SetComposeUpOption is a function that sets a ComposeUpOptions

Directories

Path Synopsis
options
down
Package down is the package for the compose down options
Package down is the package for the compose down options
kill
Package kill is the package for the compose kill options
Package kill is the package for the compose kill options
logs
Package logs is the package for the compose logs options
Package logs is the package for the compose logs options
up
Package up provides options for the compose up command
Package up provides options for the compose up command

Jump to

Keyboard shortcuts

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