Documentation
¶
Overview ¶
Package containerkit is a wrapper around the docker compose CLI. It provides a programmatic interface for managing docker compose projects by mapping docker compose commands onto typed option structs.
Package containerkit provides the container config for the wrapped client. it is built to be created in a declarative way.
Index ¶
- Constants
- Variables
- func And(preds ...bool) func() bool
- func AndFn(preds ...PredicateClosure) func() bool
- func IsComposeAttachError(err error) bool
- func IsComposeBuildError(err error) bool
- func IsComposeCommitError(err error) bool
- func IsComposeConfigError(err error) bool
- func IsComposeCpError(err error) bool
- func IsComposeCreateError(err error) bool
- func IsComposeDownError(err error) bool
- func IsComposeError(err error) bool
- func IsComposeEventsError(err error) bool
- func IsComposeExecError(err error) bool
- func IsComposeExportError(err error) bool
- func IsComposeFlagError(err error) bool
- func IsComposeImagesError(err error) bool
- func IsComposeKillError(err error) bool
- func IsComposeLogsError(err error) bool
- func IsComposeLsError(err error) bool
- func IsComposePauseError(err error) bool
- func IsComposePortError(err error) bool
- func IsComposePsError(err error) bool
- func IsComposePublishError(err error) bool
- func IsComposePullError(err error) bool
- func IsComposePushError(err error) bool
- func IsComposeRestartError(err error) bool
- func IsComposeRmError(err error) bool
- func IsComposeRunError(err error) bool
- func IsComposeScaleError(err error) bool
- func IsComposeStartError(err error) bool
- func IsComposeStatsError(err error) bool
- func IsComposeStopError(err error) bool
- func IsComposeTopError(err error) bool
- func IsComposeUnpauseError(err error) bool
- func IsComposeUpError(err error) bool
- func IsComposeVersionError(err error) bool
- func IsComposeVolumesError(err error) bool
- func IsComposeWaitError(err error) bool
- func IsComposeWatchError(err error) bool
- func NewDockerFile() *dockerFile
- func Or(preds ...bool) func() bool
- func OrFn(preds ...PredicateClosure) func() bool
- func WhenTrueOpt[T any, O ~func(T) error](check bool, fns ...O) O
- type Attach
- type BuildSpec
- type Capability
- type CheckClosure
- type Commit
- type Compose
- func (c *Compose) Attach(ctx context.Context, opt *Attach) error
- func (c *Compose) Build(ctx context.Context, opt *ComposeBuild) error
- func (c *Compose) Commit(ctx context.Context, opt *Commit) error
- func (c *Compose) Config(ctx context.Context, opt *ComposeConfig) error
- func (c *Compose) Cp(ctx context.Context, opt *Cp) error
- func (c *Compose) Create(ctx context.Context, opt *Create) error
- func (c *Compose) Down(ctx context.Context, opt *Down) error
- func (c *Compose) Events(ctx context.Context, service string, profiles ...string) (<-chan Events, <-chan error, error)
- func (c *Compose) Exec(ctx context.Context, opt *Exec) error
- func (c *Compose) Export(ctx context.Context, opt *ComposeExport) error
- func (c *Compose) Images(ctx context.Context, opt *Images) error
- func (c *Compose) Kill(ctx context.Context, opt *Kill) error
- func (c *Compose) Logs(ctx context.Context, opt *Logs) error
- func (c *Compose) Ls(ctx context.Context, opt *Ls) error
- func (c *Compose) Pause(ctx context.Context, opt *Pause) error
- func (c *Compose) Port(ctx context.Context, opt *Port) error
- func (c *Compose) Ps(ctx context.Context, opt *Ps) error
- func (c *Compose) Publish(ctx context.Context, opt *Publish) error
- func (c *Compose) Pull(ctx context.Context, opt *Pull) error
- func (c *Compose) Push(ctx context.Context, opt *Push) error
- func (c *Compose) Restart(ctx context.Context, opt *Restart) error
- func (c *Compose) Rm(ctx context.Context, opt *Rm) error
- func (c *Compose) Run(ctx context.Context, opt *Run) error
- func (c *Compose) Scale(ctx context.Context, opt *Scale) error
- func (c *Compose) Start(ctx context.Context, opt *Start) error
- func (c *Compose) Stats(ctx context.Context, opt *Stats) error
- func (c *Compose) Stop(ctx context.Context, opt *Stop) error
- func (c *Compose) Top(ctx context.Context, opt *Top) error
- func (c *Compose) Unpause(ctx context.Context, opt *Unpause) error
- func (c *Compose) Up(ctx context.Context, opt *Up) error
- func (c *Compose) Version(ctx context.Context, opt *Version) error
- func (c *Compose) Volumes(ctx context.Context, opt *Volumes) error
- func (c *Compose) Wait(ctx context.Context, opt *Wait) error
- func (c *Compose) Watch(ctx context.Context, opt *Watch) error
- type ComposeAttachError
- type ComposeBuild
- type ComposeBuildError
- type ComposeCommitError
- type ComposeConfig
- type ComposeConfigError
- type ComposeCpError
- type ComposeCreateError
- type ComposeDownError
- type ComposeError
- type ComposeEventsError
- type ComposeExecError
- type ComposeExport
- type ComposeExportError
- type ComposeFlagError
- type ComposeImagesError
- type ComposeKillError
- type ComposeLogsError
- type ComposeLsError
- type ComposePauseError
- type ComposePortError
- type ComposePsError
- type ComposePublishError
- type ComposePullError
- type ComposePushError
- type ComposeRestartError
- type ComposeRmError
- type ComposeRunError
- type ComposeScaleError
- type ComposeStartError
- type ComposeStatsError
- type ComposeStopError
- type ComposeTopError
- type ComposeUnpauseError
- type ComposeUpError
- type ComposeVersionError
- type ComposeVolumesError
- type ComposeWaitError
- type ComposeWatchError
- type Container
- func (c *Container) AddedCapabilities(caps ...Capability) *Container
- func (c *Container) AddedDevice(device string, pathInContainer string, permissions string) *Container
- func (c *Container) AddedGroups(group ...string) *Container
- func (c *Container) Apply(fns ...Mutator) *Container
- func (c *Container) Architecture(architecture string) *Container
- func (c *Container) AttachedStderr() *Container
- func (c *Container) AttachedStdin() *Container
- func (c *Container) AttachedStdout() *Container
- func (c *Container) AutoRemove() *Container
- func (c *Container) BindMountWithPropagation(source, target string, propagation MountPropagation) *Container
- func (c *Container) BlkioDeviceReadBps(devicePath string, rate int) *Container
- func (c *Container) BlkioDeviceReadBpsString(devicePath, rate string) *Container
- func (c *Container) BlkioDeviceReadIOps(devicePath string, rate uint64) *Container
- func (c *Container) BlkioDeviceWriteBps(devicePath string, rate int) *Container
- func (c *Container) BlkioDeviceWriteBpsString(devicePath, rate string) *Container
- func (c *Container) BlkioDeviceWriteIOps(devicePath string, rate uint64) *Container
- func (c *Container) BlkioWeight(weight uint16) *Container
- func (c *Container) CPUCount(count int64) *Container
- func (c *Container) CPUPercent(percent int64) *Container
- func (c *Container) CPUPeriod(period int) *Container
- func (c *Container) CPUPeriodString(period string) *Container
- func (c *Container) CPUQuota(quota int) *Container
- func (c *Container) CPUQuotaString(quota string) *Container
- func (c *Container) CPURealtimePeriod(period int) *Container
- func (c *Container) CPURealtimePeriodString(period string) *Container
- func (c *Container) CPURealtimeRuntime(runtime int64) *Container
- func (c *Container) CPUShares(shares int64) *Container
- func (c *Container) Cgroup(cgroup string) *Container
- func (c *Container) CgroupParent(parent string) *Container
- func (c *Container) Command(cmd ...string) *Container
- func (c *Container) ConsoleSize(height uint, width uint) *Container
- func (c *Container) ContainerIDFile(path string) *Container
- func (c *Container) CpusetCpus(cpus string) *Container
- func (c *Container) CpusetMems(mems string) *Container
- func (c *Container) DNSLookups(dns ...string) *Container
- func (c *Container) DNSOptions(dnsOption ...string) *Container
- func (c *Container) DNSSearches(search ...string) *Container
- func (c *Container) DeviceCgroupRules(rules ...string) *Container
- func (c *Container) DeviceRequest(driver string, count int, deviceIDs []string, capabilities [][]string) *Container
- func (c *Container) DisabledHealthCheck() *Container
- func (c *Container) DisabledNetwork() *Container
- func (c *Container) DomainName(domainname string) *Container
- func (c *Container) DroppedAllCapabilities() *Container
- func (c *Container) DroppedCapabilities(caps ...Capability) *Container
- func (c *Container) DroppedSensitiveCapabilities() *Container
- func (c *Container) Endpoint(name string, opts ...EndpointOpts) *Container
- func (c *Container) Entrypoint(entrypoint ...string) *Container
- func (c *Container) Env(key string, value string) *Container
- func (c *Container) EnvMap(env map[string]string) *Container
- func (c *Container) EscapedArgs() *Container
- func (c *Container) ExposedPort(protocol string, port string) *Container
- func (c *Container) ExtraHost(extraHosts ...string) *Container
- func (c *Container) HealthCheck(h Health) *Container
- func (c *Container) HostBindMountRecursiveRO(source, target string) *Container
- func (c *Container) HostName(hostname string) *Container
- func (c *Container) Image(image string) *Container
- func (c *Container) Imagef(stringFormat string, args ...any) *Container
- func (c *Container) Init() *Container
- func (c *Container) IpcMode(mode string) *Container
- func (c *Container) Isolation(isolation string) *Container
- func (c *Container) KernelMemory(memory int) *Container
- func (c *Container) KernelMemoryString(memory string) *Container
- func (c *Container) Label(label, value string) *Container
- func (c *Container) LogDriver(driver string, options map[string]string) *Container
- func (c *Container) MaskedPaths(paths ...string) *Container
- func (c *Container) MemoryLimit(memory int) *Container
- func (c *Container) MemoryLimitString(memory string) *Container
- func (c *Container) MemoryReservation(memory int) *Container
- func (c *Container) MemoryReservationString(memory string) *Container
- func (c *Container) MemorySwap(memorySwap int) *Container
- func (c *Container) MemorySwapString(memorySwap string) *Container
- func (c *Container) MemorySwappiness(swappiness int64) *Container
- func (c *Container) Mount(m Mount) *Container
- func (c *Container) NetworkMode(mode string) *Container
- func (c *Container) NonRecursiveBindMount(source, target string, readonly bool) *Container
- func (c *Container) OS(OS string) *Container
- func (c *Container) OSFeatures(OSFeatures ...string) *Container
- func (c *Container) OSVersion(OSVersion string) *Container
- func (c *Container) OnBuild(args ...string) *Container
- func (c *Container) OomKillDisable() *Container
- func (c *Container) OomScoreAdj(score int) *Container
- func (c *Container) PidMode(mode string) *Container
- func (c *Container) PidsLimit(limit int64) *Container
- func (c *Container) PortBindings(protocol, hostIP, hostPort, containerPort string) *Container
- func (c *Container) Privileged() *Container
- func (c *Container) PublishAllPorts() *Container
- func (c *Container) ROHostBindMount(source string, target string) *Container
- func (c *Container) RONamedVolumeMount(name, target string) *Container
- func (c *Container) RWHostBindMount(source string, target string) *Container
- func (c *Container) RWNamedVolumeMount(name, target string) *Container
- func (c *Container) RWNamedVolumeMountWithLabel(name, target, labelKey, labelValue string) *Container
- func (c *Container) RWNamedVolumeSubPath(name, target, subPath string) *Container
- func (c *Container) ReadOnlyRootfs() *Container
- func (c *Container) ReadonlyPaths(paths ...string) *Container
- func (c *Container) RestartAlways() *Container
- func (c *Container) RestartPolicy(mode RestartPolicy, maxRetryCount int) *Container
- func (c *Container) RestartPolicyAlways() *Container
- func (c *Container) RestartPolicyNever() *Container
- func (c *Container) RestartPolicyOnFailure(maxRetryCount int) *Container
- func (c *Container) RestartPolicyUnlessStopped() *Container
- func (c *Container) RestartUnlessStopped() *Container
- func (c *Container) Runtime(runtime string) *Container
- func (c *Container) SecurityOpts(opts ...string) *Container
- func (c *Container) Shell(shell ...string) *Container
- func (c *Container) ShmSize(size int) *Container
- func (c *Container) ShmSizeString(size string) *Container
- func (c *Container) StdinOnce() *Container
- func (c *Container) StdinOpen() *Container
- func (c *Container) StopSignal(signal string) *Container
- func (c *Container) StopTimeout(timeout int) *Container
- func (c *Container) StorageOpt(key, value string) *Container
- func (c *Container) Sysctls(key, value string) *Container
- func (c *Container) Tmpfs(key, value string) *Container
- func (c *Container) TmpfsMount(target string, sizeBytes int, mode os.FileMode) *Container
- func (c *Container) TmpfsMountCustomOptions(target string, sizeBytes int, flags ...[]string) *Container
- func (c *Container) TmpfsMountExec(target string, sizeBytes int) *Container
- func (c *Container) TmpfsMountUIDGID(target string, sizeBytes int, uid, gid string) *Container
- func (c *Container) Tty() *Container
- func (c *Container) UTSMode(mode string) *Container
- func (c *Container) Ulimits(name string, soft, hard int64) *Container
- func (c *Container) User(user string) *Container
- func (c *Container) UserNSMode(mode string) *Container
- func (c *Container) Validate() error
- func (c *Container) Variant(variant string) *Container
- func (c *Container) Volume(volume string) *Container
- func (c *Container) VolumeBinds(binds ...string) *Container
- func (c *Container) VolumeDriver(driver string) *Container
- func (c *Container) VolumesFrom(from string) *Container
- func (c *Container) With(setters ...any) *Container
- func (c *Container) WithContainerConfig(setters ...SetContainerConfig) *Container
- func (c *Container) WithHostConfig(setters ...SetHostConfig) *Container
- func (c *Container) WithNetworkConfig(setters ...SetNetworkConfig) *Container
- func (c *Container) WithPlatformConfig(setters ...SetPlatformConfig) *Container
- func (c *Container) WorkingDir(dir string) *Container
- type Cp
- type Create
- type Deploy
- type Down
- type EndpointOpts
- type Events
- type Exec
- type Health
- type IPAMPool
- type Images
- type Kill
- type Logs
- type Ls
- type MergedConfig
- type Mount
- type MountPropagation
- type MountType
- type Mutator
- func Each[T any](items []T, f func(i int, t T) Mutator) Mutator
- func Group(fns ...Mutator) Mutator
- func OnlyIf(check CheckClosure, f Mutator) Mutator
- func WhenTrue(check bool, fns ...Mutator) Mutator
- func WhenTrueElse(check bool, fn, elseFn Mutator) Mutator
- func WhenTrueElseFn(predicate PredicateClosure, fn, elseFn Mutator) Mutator
- func WhenTrueFn(predicate PredicateClosure, fns ...Mutator) Mutator
- type Pause
- type Port
- type PredicateClosure
- type Project
- func (p *Project) Export(file string, perm os.FileMode) error
- func (p *Project) ForEachService(fn func(name string, service *types.ServiceConfig) error) error
- func (p *Project) GetService(name string) (*types.ServiceConfig, error)
- func (p *Project) Marshal() ([]byte, error)
- func (p *Project) Unwrap() *types.Project
- func (p *Project) Validate() error
- func (p *Project) WithNetwork(name string, spec ...ProjectNetwork) *Project
- func (p *Project) WithSecret(key string, spec ...ProjectSecret) *Project
- func (p *Project) WithService(name string, service *Container, extras ...any) *Project
- func (p *Project) WithVolume(name string, spec ...ProjectVolume) *Project
- type ProjectNetwork
- type ProjectSecret
- type ProjectVolume
- type Ps
- type Publish
- type Pull
- type Push
- type Resources
- type Restart
- type RestartPolicy
- type Rm
- type Run
- type Scale
- type ServiceSecret
- type SetContainerConfig
- type SetHostConfig
- type SetNetworkConfig
- type SetPlatformConfig
- type SetServiceConfig
- func Annotation(key, value string) SetServiceConfig
- func DependsOn(service string) SetServiceConfig
- func DependsOnHealthy(service string) SetServiceConfig
- func Develop(action WatchAction, watchPath, target string, ignorePaths ...string) SetServiceConfig
- func EnvFile(path string) SetServiceConfig
- func NoAttach() SetServiceConfig
- func Profiles(profiles ...string) SetServiceConfig
- type Start
- type Stats
- type Stop
- type Top
- type Unpause
- type Up
- type UpScale
- type Version
- type Volumes
- type Wait
- type Watch
- type WatchAction
Constants ¶
const ( AUDIT_WRITE = hc.AUDIT_WRITE CHOWN = hc.CHOWN DAC_OVERRIDE = hc.DAC_OVERRIDE FOWNER = hc.FOWNER FSETID = hc.FSETID KILL = hc.KILL MKNOD = hc.MKNOD NET_BIND_SERVICE = hc.NET_BIND_SERVICE NET_RAW = hc.NET_RAW SETFCAP = hc.SETFCAP SETGID = hc.SETGID SETPCAP = hc.SETPCAP SETUID = hc.SETUID SYS_CHROOT = hc.SYS_CHROOT AUDIT_CONTROL = hc.AUDIT_CONTROL AUDIT_READ = hc.AUDIT_READ BLOCK_SUSPEND = hc.BLOCK_SUSPEND BPF = hc.BPF CHECKPOINT_RESTORE = hc.CHECKPOINT_RESTORE DAC_READ_SEARCH = hc.DAC_READ_SEARCH SYS_ADMIN = hc.SYS_ADMIN SYS_BOOT = hc.SYS_BOOT SYS_MODULE = hc.SYS_MODULE SYS_PACCT = hc.SYS_PACCT SYS_RAWIO = hc.SYS_RAWIO SYS_TIME = hc.SYS_TIME SYS_TTY_CONFIG = hc.SYS_TTY_CONFIG SYSLOG = hc.SYSLOG IPC_LOCK = hc.IPC_LOCK IPC_OWNER = hc.IPC_OWNER LEASE = hc.LEASE LINUX_IMMUTABLE = hc.LINUX_IMMUTABLE SYS_NICE = hc.SYS_NICE SYS_PTRACE = hc.SYS_PTRACE SYS_RESOURCE = hc.SYS_RESOURCE WAKE_ALARM = hc.WAKE_ALARM NET_ADMIN = hc.NET_ADMIN NET_BROADCAST = hc.NET_BROADCAST MAC_ADMIN = hc.MAC_ADMIN MAC_OVERRIDE = hc.MAC_OVERRIDE PERFMON = hc.PERFMON ALL = hc.ALL )
const ( RestartPolicyNo = hc.RestartPolicyNo RestartPolicyOnFailure = hc.RestartPolicyOnFailure RestartPolicyAlways = hc.RestartPolicyAlways RestartPolicyUnlessStopped = hc.RestartPolicyUnlessStopped )
const ( PropagationRPrivate = mount.PropagationRPrivate PropagationPrivate = mount.PropagationPrivate PropagationRSlave = mount.PropagationRSlave PropagationSlave = mount.PropagationSlave )
const ( MountBind = mount.MountTypeBind MountVolume = mount.MountTypeVolume MountTmpfs = mount.MountTypeTmpfs MountNamedPipe = mount.MountTypeNamedPipe )
Variables ¶
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") ErrComposePsError = fmt.Errorf("compose ps error") ErrComposeStartError = fmt.Errorf("compose start error") ErrComposeStopError = fmt.Errorf("compose stop error") ErrComposeRestartError = fmt.Errorf("compose restart error") ErrComposeBuildError = fmt.Errorf("compose build error") ErrComposePullError = fmt.Errorf("compose pull error") ErrComposeExecError = fmt.Errorf("compose exec error") ErrComposeAttachError = fmt.Errorf("compose attach error") ErrComposeCommitError = fmt.Errorf("compose commit error") ErrComposeConfigError = fmt.Errorf("compose config error") ErrComposeCpError = fmt.Errorf("compose cp error") ErrComposeCreateError = fmt.Errorf("compose create error") ErrComposeExportError = fmt.Errorf("compose export error") ErrComposeImagesError = fmt.Errorf("compose images error") ErrComposeLsError = fmt.Errorf("compose ls error") ErrComposePauseError = fmt.Errorf("compose pause error") ErrComposePortError = fmt.Errorf("compose port error") ErrComposePublishError = fmt.Errorf("compose publish error") ErrComposePushError = fmt.Errorf("compose push error") ErrComposeRmError = fmt.Errorf("compose rm error") ErrComposeRunError = fmt.Errorf("compose run error") ErrComposeScaleError = fmt.Errorf("compose scale error") ErrComposeStatsError = fmt.Errorf("compose stats error") ErrComposeTopError = fmt.Errorf("compose top error") ErrComposeUnpauseError = fmt.Errorf("compose unpause error") ErrComposeVersionError = fmt.Errorf("compose version error") ErrComposeVolumesError = fmt.Errorf("compose volumes error") ErrComposeWaitError = fmt.Errorf("compose wait error") ErrComposeWatchError = fmt.Errorf("compose watch error") )
Errors for the compose command and its setters.
Functions ¶
func AndFn ¶
func AndFn(preds ...PredicateClosure) func() bool
func IsComposeAttachError ¶
func IsComposeBuildError ¶
func IsComposeCommitError ¶
func IsComposeConfigError ¶
func IsComposeCpError ¶
func IsComposeCreateError ¶
func IsComposeDownError ¶
IsComposeDownError checks if the error is a ComposeDownError.
func IsComposeError ¶
IsComposeError checks if the error is a ComposeError.
func IsComposeEventsError ¶
IsComposeEventsError checks if the error is a ComposeEventsError.
func IsComposeExecError ¶
func IsComposeExportError ¶
func IsComposeFlagError ¶
IsComposeFlagError checks if the error is a ComposeFlagError.
func IsComposeImagesError ¶
func IsComposeKillError ¶
IsComposeKillError checks if the error is a ComposeKillError.
func IsComposeLogsError ¶
IsComposeLogsError checks if the error is a ComposeLogsError.
func IsComposeLsError ¶
func IsComposePauseError ¶
func IsComposePortError ¶
func IsComposePsError ¶
func IsComposePublishError ¶
func IsComposePullError ¶
func IsComposePushError ¶
func IsComposeRestartError ¶
func IsComposeRmError ¶
func IsComposeRunError ¶
func IsComposeScaleError ¶
func IsComposeStartError ¶
func IsComposeStatsError ¶
func IsComposeStopError ¶
func IsComposeTopError ¶
func IsComposeUnpauseError ¶
func IsComposeUpError ¶
IsComposeUpError checks if the error is a ComposeUpError.
func IsComposeVersionError ¶
func IsComposeVolumesError ¶
func IsComposeWaitError ¶
func IsComposeWatchError ¶
func NewDockerFile ¶
func NewDockerFile() *dockerFile
NewDockerFile creates a new dockerfile which allows you to create a dockerfile string with step by step instructions via builder pattern
note: Not safe for concurrent use.
func OrFn ¶
func OrFn(preds ...PredicateClosure) func() bool
func WhenTrueOpt ¶
WhenTrueOpt applies option funcs (SetContainerConfig, SetServiceConfig, etc.) only if check is true.
Types ¶
type Attach ¶
type Attach struct {
DetachKeys string
Index *int
NoStdin bool
NoSigProxy bool // --sig-proxy=false; Compose defaults to true
Writer io.Writer
Stdin io.Reader
Profiles []string
Flags []string
Service string // required
}
Attach is the options for the compose attach command. Service is required.
func (*Attach) GenerateFlags ¶
type BuildSpec ¶
type BuildSpec struct {
Context string
Dockerfile string
DockerfileInline string
Args map[string]string
Labels map[string]string
Tags []string
Target string
Network string
NoCache bool
Pull bool
Privileged bool
Platforms []string
CacheFrom []string
CacheTo []string
}
BuildSpec is Compose service build configuration.
type Capability ¶
type Capability = hc.Capability
Capability is a Linux capability granted or dropped on a container.
type CheckClosure ¶
type Commit ¶
type Commit struct {
Author string
Change []string // Dockerfile instructions applied to the image
Index *int
Message string
NoPause bool // --pause=false; Compose defaults to true
Writer io.Writer
Profiles []string
Flags []string
Service string // required
Repository string // optional REPOSITORY[:TAG]
}
Commit is the options for the compose commit command. Service is required.
func (*Commit) GenerateFlags ¶
type Compose ¶
type Compose struct {
// contains filtered or unexported fields
}
Compose runs docker compose commands against a Project (YAML on stdin).
func NewCompose ¶
NewCompose returns a Compose runner for the given project.
func (*Compose) Build ¶
func (c *Compose) Build(ctx context.Context, opt *ComposeBuild) error
Build runs the docker compose build command.
func (*Compose) Config ¶
func (c *Compose) Config(ctx context.Context, opt *ComposeConfig) error
Config runs the docker compose config command.
func (*Compose) Down ¶
Down runs the docker compose down command. A nil opt uses defaults (writer is os.Stdout).
func (*Compose) Events ¶
func (c *Compose) Events(ctx context.Context, service string, profiles ...string) (<-chan Events, <-chan error, error)
Events runs the docker compose events command. Pass an empty service string to receive events for all services. When the project uses profiles, pass the same profiles used for up/down (e.g. Events(ctx, "", "minimal", "full")).
func (*Compose) Exec ¶
Exec runs the docker compose exec command. Service and Command must be set on opt.
func (*Compose) Export ¶
func (c *Compose) Export(ctx context.Context, opt *ComposeExport) error
Export runs the docker compose export command. Service is required.
func (*Compose) Kill ¶
Kill runs the docker compose kill command. A nil opt uses defaults (writer is os.Stdout).
func (*Compose) Logs ¶
Logs runs the docker compose logs command. A nil opt uses defaults (writer is os.Stdout).
func (*Compose) Port ¶
Port runs the docker compose port command. Service and PrivatePort are required.
func (*Compose) Up ¶
Up runs the docker compose up command. A nil opt uses defaults (writer is os.Stdout).
type ComposeAttachError ¶
type ComposeAttachError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeAttachError ¶
func NewComposeAttachError(err error) *ComposeAttachError
func (*ComposeAttachError) Error ¶
func (e *ComposeAttachError) Error() string
func (*ComposeAttachError) Unwrap ¶
func (e *ComposeAttachError) Unwrap() error
type ComposeBuild ¶
type ComposeBuild struct {
BuildArg []string // key=value, appended as --build-arg each
Builder string
Check bool
Memory string // e.g. "2G"
NoCache bool
Print bool
Provenance bool
Pull bool
Push bool
Quiet bool
SBOM bool
SSH []string // e.g. "default" or "key=path"
WithDependencies bool
Writer io.Writer
Profiles []string
ServiceNames []string
Flags []string
}
ComposeBuild is the options for the compose build command
func (*ComposeBuild) GenerateFlags ¶
func (opt *ComposeBuild) GenerateFlags() ([]string, error)
type ComposeBuildError ¶
type ComposeBuildError struct {
Message string
// contains filtered or unexported fields
}
ComposeBuildError is the error for the compose build command
func NewComposeBuildError ¶
func NewComposeBuildError(err error) *ComposeBuildError
func (*ComposeBuildError) Error ¶
func (e *ComposeBuildError) Error() string
func (*ComposeBuildError) Unwrap ¶
func (e *ComposeBuildError) Unwrap() error
type ComposeCommitError ¶
type ComposeCommitError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeCommitError ¶
func NewComposeCommitError(err error) *ComposeCommitError
func (*ComposeCommitError) Error ¶
func (e *ComposeCommitError) Error() string
func (*ComposeCommitError) Unwrap ¶
func (e *ComposeCommitError) Unwrap() error
type ComposeConfig ¶
type ComposeConfig struct {
PrintEnvironment bool
Format string // yaml | json
Hash string // service name or "*"
PrintImages bool
LockImageDigests bool
PrintModels bool
PrintNetworks bool
NoConsistency bool
NoEnvResolution bool
NoInterpolate bool
NoNormalize bool
NoPathResolution bool
Output string
PrintProfiles bool
Quiet bool
ResolveImageDigests bool
PrintServices bool
PrintVariables bool
PrintVolumes bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
ComposeConfig is the options for the compose config command. Named ComposeConfig because Config is too generic (MergedConfig, container.Config).
func (*ComposeConfig) GenerateFlags ¶
func (opt *ComposeConfig) GenerateFlags() ([]string, error)
type ComposeConfigError ¶
type ComposeConfigError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeConfigError ¶
func NewComposeConfigError(err error) *ComposeConfigError
func (*ComposeConfigError) Error ¶
func (e *ComposeConfigError) Error() string
func (*ComposeConfigError) Unwrap ¶
func (e *ComposeConfigError) Unwrap() error
type ComposeCpError ¶
type ComposeCpError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeCpError ¶
func NewComposeCpError(err error) *ComposeCpError
func (*ComposeCpError) Error ¶
func (e *ComposeCpError) Error() string
func (*ComposeCpError) Unwrap ¶
func (e *ComposeCpError) Unwrap() error
type ComposeCreateError ¶
type ComposeCreateError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeCreateError ¶
func NewComposeCreateError(err error) *ComposeCreateError
func (*ComposeCreateError) Error ¶
func (e *ComposeCreateError) Error() string
func (*ComposeCreateError) Unwrap ¶
func (e *ComposeCreateError) Unwrap() error
type ComposeDownError ¶
type ComposeDownError struct {
Message string
// contains filtered or unexported fields
}
ComposeDownError is the error for the compose down command
func NewComposeDownError ¶
func NewComposeDownError(err error) *ComposeDownError
NewComposeDownError creates a new ComposeDownError wrapping err.
func (*ComposeDownError) Error ¶
func (e *ComposeDownError) Error() string
func (*ComposeDownError) Unwrap ¶
func (e *ComposeDownError) Unwrap() error
type ComposeError ¶
type ComposeError struct {
Message string
// contains filtered or unexported fields
}
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 ¶
type ComposeEventsError struct {
Message string
// contains filtered or unexported fields
}
ComposeEventsError is the error for the compose events command
func NewComposeEventsError ¶
func NewComposeEventsError(err error) *ComposeEventsError
NewComposeEventsError creates a new ComposeEventsError wrapping err.
func (*ComposeEventsError) Error ¶
func (e *ComposeEventsError) Error() string
func (*ComposeEventsError) Unwrap ¶
func (e *ComposeEventsError) Unwrap() error
type ComposeExecError ¶
type ComposeExecError struct {
Message string
// contains filtered or unexported fields
}
ComposeExecError is the error for the compose exec command
func NewComposeExecError ¶
func NewComposeExecError(err error) *ComposeExecError
func (*ComposeExecError) Error ¶
func (e *ComposeExecError) Error() string
func (*ComposeExecError) Unwrap ¶
func (e *ComposeExecError) Unwrap() error
type ComposeExport ¶
type ComposeExport struct {
Index *int
Output string
Writer io.Writer
Profiles []string
Flags []string
Service string // required
}
ComposeExport is the options for the compose export command. Named ComposeExport to avoid confusion with Project.Export. Service is required.
func (*ComposeExport) GenerateFlags ¶
func (opt *ComposeExport) GenerateFlags() ([]string, error)
type ComposeExportError ¶
type ComposeExportError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeExportError ¶
func NewComposeExportError(err error) *ComposeExportError
func (*ComposeExportError) Error ¶
func (e *ComposeExportError) Error() string
func (*ComposeExportError) Unwrap ¶
func (e *ComposeExportError) Unwrap() error
type ComposeFlagError ¶
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 ComposeImagesError ¶
type ComposeImagesError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeImagesError ¶
func NewComposeImagesError(err error) *ComposeImagesError
func (*ComposeImagesError) Error ¶
func (e *ComposeImagesError) Error() string
func (*ComposeImagesError) Unwrap ¶
func (e *ComposeImagesError) Unwrap() error
type ComposeKillError ¶
type ComposeKillError struct {
Message string
// contains filtered or unexported fields
}
ComposeKillError is the error for the compose kill command
func NewComposeKillError ¶
func NewComposeKillError(err error) *ComposeKillError
NewComposeKillError creates a new ComposeKillError wrapping err.
func (*ComposeKillError) Error ¶
func (e *ComposeKillError) Error() string
func (*ComposeKillError) Unwrap ¶
func (e *ComposeKillError) Unwrap() error
type ComposeLogsError ¶
type ComposeLogsError struct {
Message string
// contains filtered or unexported fields
}
ComposeLogsError is the error for the compose logs command
func NewComposeLogsError ¶
func NewComposeLogsError(err error) *ComposeLogsError
NewComposeLogsError creates a new ComposeLogsError wrapping err.
func (*ComposeLogsError) Error ¶
func (e *ComposeLogsError) Error() string
func (*ComposeLogsError) Unwrap ¶
func (e *ComposeLogsError) Unwrap() error
type ComposeLsError ¶
type ComposeLsError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeLsError ¶
func NewComposeLsError(err error) *ComposeLsError
func (*ComposeLsError) Error ¶
func (e *ComposeLsError) Error() string
func (*ComposeLsError) Unwrap ¶
func (e *ComposeLsError) Unwrap() error
type ComposePauseError ¶
type ComposePauseError struct {
Message string
// contains filtered or unexported fields
}
func NewComposePauseError ¶
func NewComposePauseError(err error) *ComposePauseError
func (*ComposePauseError) Error ¶
func (e *ComposePauseError) Error() string
func (*ComposePauseError) Unwrap ¶
func (e *ComposePauseError) Unwrap() error
type ComposePortError ¶
type ComposePortError struct {
Message string
// contains filtered or unexported fields
}
func NewComposePortError ¶
func NewComposePortError(err error) *ComposePortError
func (*ComposePortError) Error ¶
func (e *ComposePortError) Error() string
func (*ComposePortError) Unwrap ¶
func (e *ComposePortError) Unwrap() error
type ComposePsError ¶
type ComposePsError struct {
Message string
// contains filtered or unexported fields
}
ComposePsError is the error for the compose ps command
func NewComposePsError ¶
func NewComposePsError(err error) *ComposePsError
func (*ComposePsError) Error ¶
func (e *ComposePsError) Error() string
func (*ComposePsError) Unwrap ¶
func (e *ComposePsError) Unwrap() error
type ComposePublishError ¶
type ComposePublishError struct {
Message string
// contains filtered or unexported fields
}
func NewComposePublishError ¶
func NewComposePublishError(err error) *ComposePublishError
func (*ComposePublishError) Error ¶
func (e *ComposePublishError) Error() string
func (*ComposePublishError) Unwrap ¶
func (e *ComposePublishError) Unwrap() error
type ComposePullError ¶
type ComposePullError struct {
Message string
// contains filtered or unexported fields
}
ComposePullError is the error for the compose pull command
func NewComposePullError ¶
func NewComposePullError(err error) *ComposePullError
func (*ComposePullError) Error ¶
func (e *ComposePullError) Error() string
func (*ComposePullError) Unwrap ¶
func (e *ComposePullError) Unwrap() error
type ComposePushError ¶
type ComposePushError struct {
Message string
// contains filtered or unexported fields
}
func NewComposePushError ¶
func NewComposePushError(err error) *ComposePushError
func (*ComposePushError) Error ¶
func (e *ComposePushError) Error() string
func (*ComposePushError) Unwrap ¶
func (e *ComposePushError) Unwrap() error
type ComposeRestartError ¶
type ComposeRestartError struct {
Message string
// contains filtered or unexported fields
}
ComposeRestartError is the error for the compose restart command
func NewComposeRestartError ¶
func NewComposeRestartError(err error) *ComposeRestartError
func (*ComposeRestartError) Error ¶
func (e *ComposeRestartError) Error() string
func (*ComposeRestartError) Unwrap ¶
func (e *ComposeRestartError) Unwrap() error
type ComposeRmError ¶
type ComposeRmError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeRmError ¶
func NewComposeRmError(err error) *ComposeRmError
func (*ComposeRmError) Error ¶
func (e *ComposeRmError) Error() string
func (*ComposeRmError) Unwrap ¶
func (e *ComposeRmError) Unwrap() error
type ComposeRunError ¶
type ComposeRunError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeRunError ¶
func NewComposeRunError(err error) *ComposeRunError
func (*ComposeRunError) Error ¶
func (e *ComposeRunError) Error() string
func (*ComposeRunError) Unwrap ¶
func (e *ComposeRunError) Unwrap() error
type ComposeScaleError ¶
type ComposeScaleError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeScaleError ¶
func NewComposeScaleError(err error) *ComposeScaleError
func (*ComposeScaleError) Error ¶
func (e *ComposeScaleError) Error() string
func (*ComposeScaleError) Unwrap ¶
func (e *ComposeScaleError) Unwrap() error
type ComposeStartError ¶
type ComposeStartError struct {
Message string
// contains filtered or unexported fields
}
ComposeStartError is the error for the compose start command
func NewComposeStartError ¶
func NewComposeStartError(err error) *ComposeStartError
func (*ComposeStartError) Error ¶
func (e *ComposeStartError) Error() string
func (*ComposeStartError) Unwrap ¶
func (e *ComposeStartError) Unwrap() error
type ComposeStatsError ¶
type ComposeStatsError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeStatsError ¶
func NewComposeStatsError(err error) *ComposeStatsError
func (*ComposeStatsError) Error ¶
func (e *ComposeStatsError) Error() string
func (*ComposeStatsError) Unwrap ¶
func (e *ComposeStatsError) Unwrap() error
type ComposeStopError ¶
type ComposeStopError struct {
Message string
// contains filtered or unexported fields
}
ComposeStopError is the error for the compose stop command
func NewComposeStopError ¶
func NewComposeStopError(err error) *ComposeStopError
func (*ComposeStopError) Error ¶
func (e *ComposeStopError) Error() string
func (*ComposeStopError) Unwrap ¶
func (e *ComposeStopError) Unwrap() error
type ComposeTopError ¶
type ComposeTopError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeTopError ¶
func NewComposeTopError(err error) *ComposeTopError
func (*ComposeTopError) Error ¶
func (e *ComposeTopError) Error() string
func (*ComposeTopError) Unwrap ¶
func (e *ComposeTopError) Unwrap() error
type ComposeUnpauseError ¶
type ComposeUnpauseError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeUnpauseError ¶
func NewComposeUnpauseError(err error) *ComposeUnpauseError
func (*ComposeUnpauseError) Error ¶
func (e *ComposeUnpauseError) Error() string
func (*ComposeUnpauseError) Unwrap ¶
func (e *ComposeUnpauseError) Unwrap() error
type ComposeUpError ¶
type ComposeUpError struct {
Message string
// contains filtered or unexported fields
}
ComposeUpError is the error for the compose up command
func NewComposeUpError ¶
func NewComposeUpError(err error) *ComposeUpError
NewComposeUpError creates a new ComposeUpError wrapping err.
func (*ComposeUpError) Error ¶
func (e *ComposeUpError) Error() string
func (*ComposeUpError) Unwrap ¶
func (e *ComposeUpError) Unwrap() error
type ComposeVersionError ¶
type ComposeVersionError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeVersionError ¶
func NewComposeVersionError(err error) *ComposeVersionError
func (*ComposeVersionError) Error ¶
func (e *ComposeVersionError) Error() string
func (*ComposeVersionError) Unwrap ¶
func (e *ComposeVersionError) Unwrap() error
type ComposeVolumesError ¶
type ComposeVolumesError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeVolumesError ¶
func NewComposeVolumesError(err error) *ComposeVolumesError
func (*ComposeVolumesError) Error ¶
func (e *ComposeVolumesError) Error() string
func (*ComposeVolumesError) Unwrap ¶
func (e *ComposeVolumesError) Unwrap() error
type ComposeWaitError ¶
type ComposeWaitError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeWaitError ¶
func NewComposeWaitError(err error) *ComposeWaitError
func (*ComposeWaitError) Error ¶
func (e *ComposeWaitError) Error() string
func (*ComposeWaitError) Unwrap ¶
func (e *ComposeWaitError) Unwrap() error
type ComposeWatchError ¶
type ComposeWatchError struct {
Message string
// contains filtered or unexported fields
}
func NewComposeWatchError ¶
func NewComposeWatchError(err error) *ComposeWatchError
func (*ComposeWatchError) Error ¶
func (e *ComposeWatchError) Error() string
func (*ComposeWatchError) Unwrap ¶
func (e *ComposeWatchError) Unwrap() error
type Container ¶
type Container struct {
Name string // the name of the container
Config *MergedConfig // merged docker sdk configuration for container creation
Errors []error
}
func NewContainer ¶
NewContainer creates a new container with the given name. It will return a container with empty configurations ready to be set. a container is a wrapper around the docker sdk container configuration. but it can be used as a service config in a compose project
parameters:
- name: the name of the container
Note: 'name' is optional when using this container as a Compose service config. It is required when using the Docker SDK directly. If multiple strings are passed as the name, they will be joined with hyphens (e.g., "foo", "bar" -> "foo-bar").
func (*Container) AddedCapabilities ¶
func (c *Container) AddedCapabilities(caps ...Capability) *Container
func (*Container) AddedDevice ¶
func (*Container) AddedGroups ¶
func (*Container) Architecture ¶
func (*Container) AttachedStderr ¶
func (*Container) AttachedStdin ¶
func (*Container) AttachedStdout ¶
func (*Container) AutoRemove ¶
func (*Container) BindMountWithPropagation ¶
func (c *Container) BindMountWithPropagation(source, target string, propagation MountPropagation) *Container
func (*Container) BlkioDeviceReadBps ¶
func (*Container) BlkioDeviceReadBpsString ¶
func (*Container) BlkioDeviceReadIOps ¶
func (*Container) BlkioDeviceWriteBps ¶
func (*Container) BlkioDeviceWriteBpsString ¶
func (*Container) BlkioDeviceWriteIOps ¶
func (*Container) BlkioWeight ¶
func (*Container) CPUPercent ¶
func (*Container) CPUPeriodString ¶
func (*Container) CPUQuotaString ¶
func (*Container) CPURealtimePeriod ¶
func (*Container) CPURealtimePeriodString ¶
func (*Container) CPURealtimeRuntime ¶
func (*Container) CgroupParent ¶
func (*Container) ContainerIDFile ¶
func (*Container) CpusetCpus ¶
func (*Container) CpusetMems ¶
func (*Container) DNSLookups ¶
func (*Container) DNSOptions ¶
func (*Container) DNSSearches ¶
func (*Container) DeviceCgroupRules ¶
func (*Container) DeviceRequest ¶
func (*Container) DisabledHealthCheck ¶
DisabledHealthCheck disables the healthcheck.
func (*Container) DisabledNetwork ¶
func (*Container) DomainName ¶
func (*Container) DroppedAllCapabilities ¶
func (*Container) DroppedCapabilities ¶
func (c *Container) DroppedCapabilities(caps ...Capability) *Container
func (*Container) DroppedSensitiveCapabilities ¶
func (*Container) Endpoint ¶
func (c *Container) Endpoint(name string, opts ...EndpointOpts) *Container
Endpoint joins the named network. Optional EndpointOpts customize the endpoint.
func (*Container) Entrypoint ¶
func (*Container) EscapedArgs ¶
func (*Container) ExposedPort ¶
func (*Container) HealthCheck ¶
HealthCheck sets the container healthcheck from a Health value.
func (*Container) HostBindMountRecursiveRO ¶
func (*Container) KernelMemory ¶
func (*Container) KernelMemoryString ¶
func (*Container) MaskedPaths ¶
func (*Container) MemoryLimit ¶
func (*Container) MemoryLimitString ¶
func (*Container) MemoryReservation ¶
func (*Container) MemoryReservationString ¶
func (*Container) MemorySwap ¶
func (*Container) MemorySwapString ¶
func (*Container) MemorySwappiness ¶
func (*Container) NetworkMode ¶
func (*Container) NonRecursiveBindMount ¶
func (*Container) OSFeatures ¶
func (*Container) OomKillDisable ¶
func (*Container) OomScoreAdj ¶
func (*Container) PortBindings ¶
func (*Container) Privileged ¶
func (*Container) PublishAllPorts ¶
func (*Container) ROHostBindMount ¶
func (*Container) RONamedVolumeMount ¶
func (*Container) RWHostBindMount ¶
func (*Container) RWNamedVolumeMount ¶
func (*Container) RWNamedVolumeMountWithLabel ¶
func (*Container) RWNamedVolumeSubPath ¶
func (*Container) ReadOnlyRootfs ¶
func (*Container) ReadonlyPaths ¶
func (*Container) RestartAlways ¶
func (*Container) RestartPolicy ¶
func (c *Container) RestartPolicy(mode RestartPolicy, maxRetryCount int) *Container
func (*Container) RestartPolicyAlways ¶
func (*Container) RestartPolicyNever ¶
func (*Container) RestartPolicyOnFailure ¶
func (*Container) RestartPolicyUnlessStopped ¶
func (*Container) RestartUnlessStopped ¶
RestartUnlessStopped is an alias for RestartPolicyUnlessStopped.
func (*Container) SecurityOpts ¶
func (*Container) ShmSizeString ¶
func (*Container) StopSignal ¶
func (*Container) StopTimeout ¶
func (*Container) StorageOpt ¶
func (*Container) TmpfsMount ¶
func (*Container) TmpfsMountCustomOptions ¶
func (*Container) TmpfsMountExec ¶
func (*Container) TmpfsMountUIDGID ¶
func (*Container) UserNSMode ¶
func (*Container) Validate ¶
Validate validates the container config. It will return an error if the container has errors.
func (*Container) VolumeBinds ¶
func (*Container) VolumeDriver ¶
func (*Container) VolumesFrom ¶
func (*Container) With ¶
With sets the container config via the setter functions. It will return a container with the container config set. If any of the setters return an error, the error will be appended to the container's error slice.
parameters:
- setters: the setters to set the container config
note: setters can be any type that implements the SetContainerConfig, SetHostConfig, SetNetworkConfig, or SetPlatformConfig function type. If a setter is nil, it will be skipped.
func (*Container) WithContainerConfig ¶
func (c *Container) WithContainerConfig(setters ...SetContainerConfig) *Container
WithContainerConfig sets the container config via the setter functions. It will return a container with the container config set. If any of the setters return an error, the error will be appended to the container's error slice. parameters:
- setters: the setters to set the container config
func (*Container) WithHostConfig ¶
func (c *Container) WithHostConfig(setters ...SetHostConfig) *Container
WithHostConfig sets the host config via the setter functions. It will return a container with the host config set. If any of the setters return an error, the error will be appended to the container's error slice.
parameters:
- setters: the setters to set the host config
func (*Container) WithNetworkConfig ¶
func (c *Container) WithNetworkConfig(setters ...SetNetworkConfig) *Container
WithNetworkConfig sets the network config via the setter functions. It will return a container with the network config set. If any of the setters return an error, the error will be appended to the container's error slice.
parameters:
- setters: the setters to set the network config
func (*Container) WithPlatformConfig ¶
func (c *Container) WithPlatformConfig(setters ...SetPlatformConfig) *Container
WithPlatformConfig sets the platform config via the setter functions. It will return a container with the platform config set. If any of the setters return an error, the error will be appended to the container's error slice. parameters:
- setters: the setters to set the platform config
func (*Container) WorkingDir ¶
type Cp ¶
type Cp struct {
All bool
Archive bool
FollowLink bool
Index *int
Writer io.Writer
Stdin io.Reader // used when Source or Dest is "-"
Profiles []string
Flags []string
Source string // required
Dest string // required
}
Cp is the options for the compose cp command. Source and Dest are required (SERVICE:PATH or PATH or "-").
func (*Cp) GenerateFlags ¶
type Create ¶
type Create struct {
Build bool
ForceRecreate bool
NoBuild bool
NoRecreate bool
Pull string
QuietPull bool
RemoveOrphans bool
Scale []UpScale
Yes bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
Create is the options for the compose create command.
func (*Create) GenerateFlags ¶
type Deploy ¶
type Deploy struct {
Mode string
Replicas *int
Labels map[string]string
Limits *Resources
Reservations *Resources
}
Deploy is Compose deploy configuration.
type Down ¶
type Down struct {
RemoveOrphans bool
Timeout *int
RemoveImage *string
RemoveVolumes bool
Flags []string
Writer io.Writer
Profiles []string
ServiceNames []string
}
Down is the options for the compose down command
func (*Down) GenerateFlags ¶
type EndpointOpts ¶
type EndpointOpts struct {
Aliases []string
Links []string
MacAddress string
DriverOptions map[string]string
IPv4 string
IPv6 string
LinkLocalIPs []string
}
EndpointOpts are optional settings for a network endpoint.
type Events ¶
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 Exec ¶
type Exec struct {
Detach bool
Env []string // key=value, passed as -e each
Index *int // --index for multi-replica services
NoTTY bool // -T: disable TTY
Privileged bool
User string // -u
Workdir string // -w
Writer io.Writer
Stdin io.Reader // optional; forwarded to the container after compose file is read
Profiles []string
Service string // required: service name
Command []string // required: command and args (e.g. ["sh", "-c", "echo hi"])
}
Exec is the options for the compose exec command. Usage: docker compose exec [OPTIONS] SERVICE COMMAND [ARGS...] Service and Command are required; set via WithService and WithCommand.
func (*Exec) GenerateFlags ¶
type Health ¶
type Health struct {
Test []string
Timeout int
Interval int
StartPeriod int
Retries int
TimeoutD string
IntervalD string
StartPeriodD string
}
Health is a container healthcheck. Timeout/Interval/StartPeriod are seconds unless the matching *D field is a duration string ("2s", "1m").
type IPAMPool ¶
type IPAMPool struct {
Subnet string
Gateway string
IPRange string
AuxiliaryAddresses map[string]string
}
IPAMPool is a project network IPAM pool.
type Images ¶
type Images struct {
Format string // table | json
Quiet bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
Images is the options for the compose images command.
func (*Images) GenerateFlags ¶
type Kill ¶
type Kill struct {
Signal *string
RemoveOrphans bool
Flags []string
Writer io.Writer
Profiles []string
ServiceNames []string
}
Kill is the options for the compose kill command
func (*Kill) GenerateFlags ¶
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 Logs ¶
type Logs struct {
Tail *int
Follow bool
NoLogPrefix bool
Writer io.Writer
Flags []string
Profiles []string
ServiceNames []string
}
Logs is the options for the compose logs command
func (*Logs) GenerateFlags ¶
type Ls ¶
type Ls struct {
All bool
Filter []string
Format string
Quiet bool
Writer io.Writer
Profiles []string
Flags []string
}
Ls is the options for the compose ls command (lists Compose projects on the engine).
func (*Ls) GenerateFlags ¶
type MergedConfig ¶
type MergedConfig struct {
Container *container.Config // the container configuration
Host *container.HostConfig // the host configuration
Network *network.NetworkingConfig // the network configuration
Platform *ocispec.Platform // the platform configuration
}
type MountPropagation ¶
type MountPropagation = mount.Propagation
MountPropagation is a bind-mount propagation mode.
type Mutator ¶
type Mutator func(*Container)
Mutator mutates a container. Used with Apply / WhenTrue / Group.
func OnlyIf ¶
func OnlyIf(check CheckClosure, f Mutator) Mutator
func WhenTrueElse ¶
func WhenTrueElseFn ¶
func WhenTrueElseFn(predicate PredicateClosure, fn, elseFn Mutator) Mutator
func WhenTrueFn ¶
func WhenTrueFn(predicate PredicateClosure, fns ...Mutator) Mutator
type Port ¶
type Port struct {
Index *int
Protocol string // tcp | udp
Writer io.Writer
Profiles []string
Flags []string
Service string // required
PrivatePort int // required
}
Port is the options for the compose port command. Service and PrivatePort are required.
func (*Port) GenerateFlags ¶
type PredicateClosure ¶
type PredicateClosure func() bool
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project is a wrapper around types.Project It provides methods to create and manage a docker Compose project.
func NewProject ¶
NewProject creates a new project with the given name. It initializes the project with an empty service list. The name is used as the project name in the compose file.
func (*Project) Export ¶
Export exports the project to a file parameters:
- file: the file path to export the project to
- perm: the permission of the file
func (*Project) ForEachService ¶
ForEachService iterates over each service in the project and calls the provided function to provide the ability to mutate a service parameters:
- fn: the function to call for each service
returns an error if the function returns an error
func (*Project) GetService ¶
func (p *Project) GetService(name string) (*types.ServiceConfig, error)
GetService returns a service from the project parameters:
- name: the name of the service
returns the service and an error if the service is not found or the project has no services
func (*Project) Validate ¶
Validate validates the project returns an error if the project has errors
func (*Project) WithNetwork ¶
func (p *Project) WithNetwork(name string, spec ...ProjectNetwork) *Project
WithNetwork defines a new network in the project
func (*Project) WithSecret ¶
func (p *Project) WithSecret(key string, spec ...ProjectSecret) *Project
WithSecret defines a new secret in the project
func (*Project) WithService ¶
WithService defines a new service in the project parameters:
- name: the name of the service
- service: the container to create the service from
- setters: the setters to apply to the service
func (*Project) WithVolume ¶
func (p *Project) WithVolume(name string, spec ...ProjectVolume) *Project
WithVolume defines a new volume in the project parameters:
- name: the name of the volume
- volume: the volume to create the volume from
type ProjectNetwork ¶
type ProjectNetwork struct {
Driver string
DriverOptions map[string]string
Internal bool
Attachable bool
EnableIPv6 bool
Labels map[string]string
IPAMDriver string
IPAMPools []IPAMPool
}
ProjectNetwork is extra config for Project.WithNetwork.
type ProjectSecret ¶
type ProjectSecret struct {
Name string
File string
Content string
Environment string
External bool
Driver string
DriverOptions map[string]string
TemplateDriver string
}
ProjectSecret is extra config for Project.WithSecret.
type ProjectVolume ¶
type ProjectVolume struct {
Driver string
DriverOptions map[string]string
Labels map[string]string
}
ProjectVolume is extra config for Project.WithVolume.
type Ps ¶
type Ps struct {
All bool
Filter []string // e.g. "status=running"
Format string
NoTrunc bool
Orphans *bool // nil = default (true); false = --no-orphans
Quiet bool
Services bool // --services: display services
Status string
Writer io.Writer
Profiles []string
ServiceNames []string
Flags []string
}
Ps is the options for the compose ps command
func (*Ps) GenerateFlags ¶
type Publish ¶
type Publish struct {
App bool
OCIVersion string
ResolveImageDigests bool
WithEnv bool
Yes bool
Writer io.Writer
Profiles []string
Flags []string
Repository string // required REPOSITORY[:TAG]
}
Publish is the options for the compose publish command. Repository is required.
func (*Publish) GenerateFlags ¶
type Pull ¶
type Pull struct {
IgnoreBuildable bool
IgnorePullFailures bool
IncludeDeps bool
Policy string // e.g. "missing", "always", "never"
Quiet bool
Writer io.Writer
Profiles []string
ServiceNames []string
Flags []string
}
Pull is the options for the compose pull command
func (*Pull) GenerateFlags ¶
type Push ¶
type Push struct {
IgnorePushFailures bool
IncludeDeps bool
Quiet bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
Push is the options for the compose push command.
func (*Push) GenerateFlags ¶
type Restart ¶
type Restart struct {
NoDeps bool
Timeout *int
Writer io.Writer
Profiles []string
ServiceNames []string
Flags []string
}
Restart is the options for the compose restart command
func (*Restart) GenerateFlags ¶
type RestartPolicy ¶
type RestartPolicy = hc.RestartPolicy
RestartPolicy is a Docker restart policy name.
type Rm ¶
type Rm struct {
Force bool
Stop bool
Volumes bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
Rm is the options for the compose rm command.
func (*Rm) GenerateFlags ¶
type Run ¶
type Run struct {
Build bool
CapAdd []string
CapDrop []string
Detach bool
Entrypoint string
Env []string
EnvFromFile []string
Interactive *bool // nil = Compose default (true)
Label []string
Name string
NoDeps bool
NoTTY bool
Publish []string
Pull string
Quiet bool
QuietBuild bool
QuietPull bool
RemoveOrphans bool
Rm bool
ServicePorts bool
UseAliases bool
User string
Volume []string
Workdir string
Writer io.Writer
Stdin io.Reader
Profiles []string
Flags []string
Service string // required
Command []string // optional
}
Run is the options for the compose run command. Service is required. Command is optional (defaults to the service command).
func (*Run) GenerateFlags ¶
type Scale ¶
type Scale struct {
NoDeps bool
Replicas []UpScale
Writer io.Writer
Profiles []string
Flags []string
}
Scale is the options for the compose scale command. Replicas is required (at least one SERVICE=NUM).
func (*Scale) GenerateFlags ¶
type ServiceSecret ¶
ServiceSecret is a service-level secret reference.
type SetContainerConfig ¶
SetContainerConfig is a function that sets the container config
type SetHostConfig ¶
type SetHostConfig func(config *container.HostConfig) error
SetHostConfig is a function that sets the host config
type SetNetworkConfig ¶
type SetNetworkConfig func(config *network.NetworkingConfig) error
SetNetworkConfig is a function that sets the network config
type SetPlatformConfig ¶
SetPlatformConfig is a function that sets the platform config
type SetServiceConfig ¶
type SetServiceConfig func(service *types.ServiceConfig) error
SetServiceConfig is a function that sets the service config
func Annotation ¶
func Annotation(key, value string) SetServiceConfig
Annotation sets a service annotation.
func DependsOn ¶
func DependsOn(service string) SetServiceConfig
DependsOn marks a service as depending on another (condition: started).
func DependsOnHealthy ¶
func DependsOnHealthy(service string) SetServiceConfig
DependsOnHealthy marks a service as depending on another becoming healthy.
func Develop ¶
func Develop(action WatchAction, watchPath, target string, ignorePaths ...string) SetServiceConfig
Develop sets Compose watch/develop config.
func EnvFile ¶
func EnvFile(path string) SetServiceConfig
EnvFile adds a required env file to a service.
func Profiles ¶
func Profiles(profiles ...string) SetServiceConfig
Profiles assigns Compose profiles to a service.
type Start ¶
type Start struct {
Wait bool
WaitTimeout *int
Writer io.Writer
Profiles []string
ServiceNames []string
Flags []string
}
Start is the options for the compose start command
func (*Start) GenerateFlags ¶
type Stats ¶
type Stats struct {
All bool
Format string
NoStream bool
NoTrunc bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
Stats is the options for the compose stats command.
func (*Stats) GenerateFlags ¶
type Stop ¶
type Stop struct {
Timeout *int
Writer io.Writer
Profiles []string
ServiceNames []string
Flags []string
}
Stop is the options for the compose stop command
func (*Stop) GenerateFlags ¶
type Unpause ¶
Unpause is the options for the compose unpause command.
func (*Unpause) GenerateFlags ¶
type Up ¶
type Up 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 []UpScale
Timeout *int
Timestamps bool
Wait bool
WaitTimeout *int
Watch bool
Yes bool
Profiles []string
Flags []string
Writer io.Writer
ServiceNames []string
Errs []error
}
Up is the options for the compose up command
func (*Up) GenerateFlags ¶
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 Version ¶
type Version struct {
Format string // pretty | json
Short bool
Writer io.Writer
Profiles []string
Flags []string
}
Version is the options for the compose version command.
func (*Version) GenerateFlags ¶
type Volumes ¶
type Volumes struct {
Format string
Quiet bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
Volumes is the options for the compose volumes command.
func (*Volumes) GenerateFlags ¶
type Wait ¶
type Wait struct {
DownProject bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string // required
}
Wait is the options for the compose wait command. ServiceNames is required.
func (*Wait) GenerateFlags ¶
type Watch ¶
type Watch struct {
NoUp bool
NoPrune bool // --prune=false; Compose defaults to true
Quiet bool
Writer io.Writer
Profiles []string
Flags []string
ServiceNames []string
}
Watch is the options for the compose watch command.
func (*Watch) GenerateFlags ¶
type WatchAction ¶
type WatchAction string
WatchAction is a Compose develop watch action.
const ( WatchActionSync WatchAction = "sync" WatchActionRebuild WatchAction = "rebuild" WatchActionSyncRestart WatchAction = "sync+restart" )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
config/cc
Package cc provides the options for the container config.
|
Package cc provides the options for the container config. |
|
config/hc
Package hc provides the options for the host config.
|
Package hc provides the options for the host config. |
|
config/hc/mount
Package mount provides the options for the mount config in the host config.
|
Package mount provides the options for the mount config in the host config. |
|
config/nc
Package nc provides the options for the network config.
|
Package nc provides the options for the network config. |
|
config/nc/endpoint
Package endpoint provides the options for the endpoint config in the network config.
|
Package endpoint provides the options for the endpoint config in the network config. |
|
config/nc/endpoint/ipam
Package ipam provides the options for the IPAM config in the endpoint config.
|
Package ipam provides the options for the IPAM config in the endpoint config. |
|
config/pc
Package pc provides the options for the platform config.
|
Package pc provides the options for the platform config. |
|
config/sc
Package sc provides functions to set the service config
|
Package sc provides functions to set the service config |
|
config/sc/build
Package build provides functions to set the build config for a service
|
Package build provides functions to set the build config for a service |
|
config/sc/build/ulimit
Package ulimit provides a set of functions to configure the ulimits for the build
|
Package ulimit provides a set of functions to configure the ulimits for the build |
|
config/sc/deploy
Package deploy provides functions to set the deploy configuration for a service
|
Package deploy provides functions to set the deploy configuration for a service |
|
config/sc/deploy/resource
Package resource provides functions to set the resource configuration for a service deploy
|
Package resource provides functions to set the resource configuration for a service deploy |
|
config/sc/deploy/resource/device
Package device provides functions to set the device configuration for a service deploys resource
|
Package device provides functions to set the device configuration for a service deploys resource |
|
config/sc/deploy/update
Package update provides functions to set the update configuration for a service deploy
|
Package update provides functions to set the update configuration for a service deploy |
|
config/sc/network
Package network provides functions to set the network configuration for a project
|
Package network provides functions to set the network configuration for a project |
|
config/sc/network/pool
Package pool provides functions to set the ipam pool configuration for a project
|
Package pool provides functions to set the ipam pool configuration for a project |
|
config/sc/secrets/projectsecret
Package projectsecret provides a set of functions to configure the secret for the project
|
Package projectsecret provides a set of functions to configure the secret for the project |
|
config/sc/secrets/secretservice
Package secretservice provides a set of functions to configure the secrets for the service
|
Package secretservice provides a set of functions to configure the secrets for the service |
|
config/sc/volume
Package volume provides functions to set the volume configuration for a project
|
Package volume provides functions to set the volume configuration for a project |