compose

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MPL-2.0 Imports: 13 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func NewBuilder

func NewBuilder() *Builder

func (*Builder) AddNetwork added in v1.0.3

func (b *Builder) AddNetwork(n *Network) *Builder

func (*Builder) AddService

func (b *Builder) AddService(sb ServiceBuilder) *Builder

func (*Builder) AddVolume added in v1.3.2

func (b *Builder) AddVolume(v string) *Builder

func (*Builder) Build

func (b *Builder) Build() (*Compose, error)

func (*Builder) MustBuild

func (b *Builder) MustBuild() *Compose

type Command added in v1.3.0

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

func NewCommand added in v1.3.0

func NewCommand(c *Compose, dir string, stdout, stderr io.Writer) (*Command, error)

func (*Command) Close added in v1.3.0

func (c *Command) Close() error

func (*Command) Down added in v1.3.0

func (c *Command) Down(args ...string) error

func (*Command) File added in v1.3.0

func (c *Command) File() string

func (*Command) Logs added in v1.3.0

func (c *Command) Logs(args ...string) error

func (*Command) Project added in v1.3.0

func (c *Command) Project() string

func (*Command) Ps added in v1.3.0

func (c *Command) Ps(args ...string) error

func (*Command) Runtime added in v1.3.0

func (c *Command) Runtime() string

func (*Command) ServiceExitCode added in v1.4.0

func (c *Command) ServiceExitCode(service string) (int, error)

func (*Command) Stop added in v1.4.0

func (c *Command) Stop(args ...string) error

func (*Command) Up added in v1.3.0

func (c *Command) Up(args ...string) error

func (*Command) Wait added in v1.3.0

func (c *Command) Wait(interval, timeout time.Duration, services []string) error

type Compose

type Compose struct {
	Services map[string]*Service `yaml:"services,omitempty"`
	Networks map[string]*Network `yaml:"networks,omitempty"`
	Volumes  map[string]*Volume  `yaml:"volumes,omitempty"`
}

func New added in v1.3.0

func New() *Compose

func (*Compose) AddNetwork added in v1.3.0

func (c *Compose) AddNetwork(n *Network) error

func (*Compose) AddService added in v1.3.0

func (c *Compose) AddService(s *Service) error

func (*Compose) AddVolume added in v1.3.2

func (c *Compose) AddVolume(v string) error

func (*Compose) WriteTo added in v1.3.0

func (c *Compose) WriteTo(w io.Writer) (int, error)

type HealthCheck

type HealthCheck struct {
	Test []string `yaml:"test,omitempty"`
	// Interval between two health checks, the default is 30 seconds.
	Interval time.Duration `yaml:"interval,omitempty"`
	// The health check command runs the timeout period.
	// If this time is exceeded, the health check is regarded as a failure.
	Timeout time.Duration `yaml:"timeout,omitempty"`
	// When the specified number of consecutive failures, the container status is treated as unhealthy, the default is 3 times.
	Retries uint `yaml:"retries,omitempty"`
	// The number of seconds to start the health check after the container starts, the default is 0 seconds.
	StartPeriod time.Duration `yaml:"start_period,omitempty"`
}

type IPAM added in v1.0.3

type IPAM struct {
	Config []IPAMConfig `yaml:"config"`
}

func (*IPAM) Validate added in v1.0.3

func (i *IPAM) Validate() error

type IPAMConfig added in v1.0.3

type IPAMConfig struct {
	Subnet  string `yaml:"subnet"`
	Gateway string `yaml:"gateway"`
}

func (*IPAMConfig) Validate added in v1.0.3

func (c *IPAMConfig) Validate() error

type Network added in v1.0.3

type Network struct {
	Name   string `yaml:"name"`
	Driver string `yaml:"driver"`
	IPAM   IPAM   `yaml:"ipam"`
}

func (*Network) Validate added in v1.0.3

func (n *Network) Validate() error

type Service

type Service struct {
	Name        string                    `yaml:"-"`
	Image       string                    `yaml:"image,omitempty"`
	Command     []string                  `yaml:"command,omitempty"`
	Environment map[string]string         `yaml:"environment,omitempty"`
	Ports       []string                  `yaml:"ports,omitempty"`
	Volumes     []string                  `yaml:"volumes,omitempty"`
	HealthCheck *HealthCheck              `yaml:"healthcheck,omitempty"`
	Network     map[string]ServiceNetwork `yaml:"networks,omitempty"`
	Privileged  bool                      `yaml:"privileged,omitempty"`
	CPUs        int                       `yaml:"cpus,omitempty"`
	CPUSet      string                    `yaml:"cpuset,omitempty"`
}

func (*Service) Service

func (s *Service) Service() *Service

func (*Service) Validate

func (s *Service) Validate() error

type ServiceBuilder

type ServiceBuilder interface {
	Service() *Service
}

type ServiceNetwork added in v1.0.3

type ServiceNetwork struct {
	IPv4 string `yaml:"ipv4_address,omitempty"`
}

type Volume added in v1.3.2

type Volume struct{}

Jump to

Keyboard shortcuts

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