Documentation ¶
Index ¶
- Constants
- func AddDockerComposeLabel(project *types.Project)
- func CompareProjectImage(old, new *types.Project) (onlyInOld, addedInNew []string)
- func EnableAll(p *types.Project) *types.Project
- func FindServicesByLabels(p *types.Project, labels []string) []types.ServiceConfig
- func InitializeDockerCli(clientOpt *flags.ClientOptions, opts ...command.CLIOption) (cli *command.DockerCli, err error)
- func PreloadConfigDetails(conf types.ConfigDetails) (types.ConfigDetails, error)
- func Reverse(src *types.Project) (dst *types.Project, err error)
- type ComposeProjectLoader
- type ComposeServiceLoader
- type Loader
- type LoaderProxy
- func (p *LoaderProxy) ConfigDetails() types.ConfigDetails
- func (p *LoaderProxy) DockerCli() *command.DockerCli
- func (p *LoaderProxy) Load(ctx context.Context) (*types.Project, error)
- func (p *LoaderProxy) LoadComposeService(ctx context.Context, ops ...func(p *types.Project) error) (*Service, error)
- func (p *LoaderProxy) Options() []func(*loader.Options)
- func (p *LoaderProxy) PreloadConfigDetails() error
- func (p *LoaderProxy) ProjectName() string
- func (p *LoaderProxy) UpdateConfigDetails(configDetails types.ConfigDetails)
- func (p *LoaderProxy) UpdateDockerCli(dockerCli *command.DockerCli)
- func (p *LoaderProxy) UpdateOptions(options []func(*loader.Options))
- func (p *LoaderProxy) UpdateProjectName(projectName string)
- type NamedResource
- type Output
- type OutputLine
- type Resource
- type Service
- func (s *Service) Client() client.APIClient
- func (s *Service) Create(ctx context.Context, options api.CreateOptions) (Output, error)
- func (s *Service) Down(ctx context.Context, options api.DownOptions) (Output, error)
- func (s *Service) DryRunMode(ctx context.Context) (*Service, context.Context, error)
- func (s *Service) Kill(ctx context.Context, options api.KillOptions) (Output, error)
- func (s *Service) Ps(ctx context.Context, options api.PsOptions) ([]api.ContainerSummary, error)
- func (s *Service) Remove(ctx context.Context, options api.RemoveOptions) (Output, error)
- func (s *Service) Restart(ctx context.Context, options api.RestartOptions) (Output, error)
- func (s *Service) Start(ctx context.Context, options api.StartOptions) (Output, error)
- func (s *Service) Stop(ctx context.Context, options api.StopOptions) (Output, error)
- func (s *Service) UpdateProject(mutators ...func(p *types.Project) *types.Project)
- type State
Constants ¶
const (
DryRunModePrefix = "DRY-RUN MODE - "
)
Variables ¶
This section is empty.
Functions ¶
func AddDockerComposeLabel ¶
AddDockerComposeLabel changes service.CustomLabels so that is can be found by docker compose v2.
In contrast to compose/v2, AddDockerComposeLabel adds labels also to Disabled services.
func CompareProjectImage ¶
CompareProjectImage compares 2 projects and return image names which only exists in old, new respectively.
If any of image is not tagged, it will resolve by adding `:latest`.
func EnableAll ¶
EnableAll adds DisabledServices to Services and set empty Services to DisabledServices.
func FindServicesByLabels ¶
func FindServicesByLabels(p *types.Project, labels []string) []types.ServiceConfig
FindServicesByLabels selects services in p by given labels.
func InitializeDockerCli ¶
func InitializeDockerCli( clientOpt *flags.ClientOptions, opts ...command.CLIOption, ) (cli *command.DockerCli, err error)
InitializeDockerCli initializes DockerCli.
If clientOpt is nil, cli will be initialized with &flags.ClientOptions{Context: "default"}.
opts will be applied twice, therefore all ops must be idempotent and/or must be aware of it. This is to encounter the case where passing malformed *flag.ClientOptions may cause it to exit by calling os.Exit(1). To prevent it from silently dying, this function sets err output stream to os.Stderr if it is not set. After initialization, it re-applies ops to ensure err output stream is what the caller wants to be.
func PreloadConfigDetails ¶
func PreloadConfigDetails(conf types.ConfigDetails) (types.ConfigDetails, error)
PreloadConfigDetails loads content and parse content if each corresponding field is not present in given conf.
Types ¶
type ComposeProjectLoader ¶
type ComposeServiceLoader ¶
type Loader ¶
type Loader struct { DockerCli *command.DockerCli ProjectName string ConfigDetails types.ConfigDetails Options []func(*loader.Options) }
type LoaderProxy ¶
type LoaderProxy struct {
// contains filtered or unexported fields
}
func NewLoaderProxy ¶
func NewLoaderProxy( projectName string, configDetails types.ConfigDetails, options []func(*loader.Options), clientOpt *flags.ClientOptions, ops ...command.DockerCliOption, ) (*LoaderProxy, error)
func (*LoaderProxy) ConfigDetails ¶
func (p *LoaderProxy) ConfigDetails() types.ConfigDetails
func (*LoaderProxy) DockerCli ¶
func (p *LoaderProxy) DockerCli() *command.DockerCli
func (*LoaderProxy) LoadComposeService ¶
func (*LoaderProxy) Options ¶
func (p *LoaderProxy) Options() []func(*loader.Options)
func (*LoaderProxy) PreloadConfigDetails ¶
func (p *LoaderProxy) PreloadConfigDetails() error
func (*LoaderProxy) ProjectName ¶
func (p *LoaderProxy) ProjectName() string
func (*LoaderProxy) UpdateConfigDetails ¶
func (p *LoaderProxy) UpdateConfigDetails(configDetails types.ConfigDetails)
func (*LoaderProxy) UpdateDockerCli ¶
func (p *LoaderProxy) UpdateDockerCli(dockerCli *command.DockerCli)
func (*LoaderProxy) UpdateOptions ¶
func (p *LoaderProxy) UpdateOptions(options []func(*loader.Options))
func (*LoaderProxy) UpdateProjectName ¶
func (p *LoaderProxy) UpdateProjectName(projectName string)
type NamedResource ¶
func (NamedResource) String ¶
func (nr NamedResource) String() string
type Output ¶
type Output struct { Resource map[NamedResource]OutputLine Out, Err string }
type OutputLine ¶
type OutputLine struct { Name string Num int Resource Resource State State Desc string DryRunMode bool }
func DecodeComposeOutputLine ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
NewService returns a new wrapped compose service proxy. NewService is not goroutine safe. It mutates given project.
func (*Service) DryRunMode ¶
DryRunMode switches c to dry run mode if dryRun is true. Once stepped, implementations might not change back to normal mode even if dryRun is false. User must call this only once and only when the user whishes to use dry run client.
type State ¶
type State string
Copied from https://github.com/docker/compose/blob/19bbb12fac83e19f3ef888722cbb32825b4088e6/pkg/progress/event.go
const ( StateError State = "Error" StateCreating State = "Creating" StateStarting State = "Starting" StateStarted State = "Started" StateWaiting State = "Waiting" StateHealthy State = "Healthy" StateExited State = "Exited" StateRestarting State = "Restarting" StateRestarted State = "Restarted" StateRunning State = "Running" StateCreated State = "Created" StateStopping State = "Stopping" StateStopped State = "Stopped" StateKilling State = "Killing" StateKilled State = "Killed" StateRemoving State = "Removing" StateRemoved State = "Removed" StateSkipped State = "Skipped" // depends_on is set, required is false and dependency service is not running nor present. StateRecreate State = "Recreate" StateRecreated State = "Recreated" )