Documentation
¶
Index ¶
- Constants
- func ContainerName(project, service string) string
- func ContainerStatus(name string) (string, error)
- func DeleteNetwork(project string)
- func Down(name string, opts StopOptions) error
- func EnsureNetwork(project string) error
- func HealthcheckExecArgs(hc *types.HealthCheckConfig) ([]string, error)
- func Logs(name string, follow bool) error
- func NetworkName(project string) string
- func PS(project string) error
- func PrepareService(svc types.ServiceConfig) types.ServiceConfig
- func RefreshPeerHosts(project, startedService string, services map[string]types.ServiceConfig) error
- func RemoveNamedVolumes(project string) error
- func RemoveOrphans(project string, services map[string]types.ServiceConfig) error
- func RunArgs(project string, svc types.ServiceConfig) ([]string, error)
- func Start(name string) error
- func Stop(name string, opts StopOptions) error
- func UnsupportedServiceKeys(svc types.ServiceConfig) []string
- func Up(project string, svc types.ServiceConfig, opts UpOptions) error
- func WaitForDependency(project string, dep types.ServiceConfig, condition string, ...) error
- func WaitHealthy(project string, svc types.ServiceConfig, timeout time.Duration) error
- func WarnContainerCLIVersion()
- func WarnUnsupportedKeys(w io.Writer, project *types.Project)
- type ContainerInfo
- type ContainerRecord
- type StopOptions
- type UpOptions
Constants ¶
const ( LabelProject = "com.apple-compose.project" LabelService = "com.apple-compose.service" )
Label keys stamped on every container we start.
const LabelConfigHash = "com.apple-compose.config-hash"
const LabelHostsHash = "com.apple-compose.hosts-hash"
Variables ¶
This section is empty.
Functions ¶
func ContainerName ¶
ContainerName returns the canonical name for a service container.
func ContainerStatus ¶ added in v0.3.0
ContainerStatus returns the status of a container by name.
func EnsureNetwork ¶
EnsureNetwork creates the project network if it doesn't exist. Network commands require macOS 26+; on older systems this is a no-op.
func HealthcheckExecArgs ¶ added in v0.6.0
func HealthcheckExecArgs(hc *types.HealthCheckConfig) ([]string, error)
HealthcheckExecArgs returns the command to run inside a container for a healthcheck test.
func NetworkName ¶
NetworkName returns the shared network name for a project.
func PrepareService ¶ added in v0.6.0
func PrepareService(svc types.ServiceConfig) types.ServiceConfig
PrepareService applies runtime workarounds (e.g. virtiofs DB volumes) before RunArgs.
func RefreshPeerHosts ¶ added in v0.6.0
func RefreshPeerHosts(project, startedService string, services map[string]types.ServiceConfig) error
RefreshPeerHosts recreates running peers whose /etc/hosts is missing the newly started service.
func RemoveNamedVolumes ¶ added in v0.6.0
RemoveNamedVolumes deletes on-disk data for named volumes in a project.
func RemoveOrphans ¶ added in v0.6.0
func RemoveOrphans(project string, services map[string]types.ServiceConfig) error
RemoveOrphans deletes containers belonging to the project whose service is no longer defined in the compose file.
func RunArgs ¶
func RunArgs(project string, svc types.ServiceConfig) ([]string, error)
RunArgs builds the `container run` argument list for a service. Call PrepareService first to apply virtiofs DB workarounds.
func Stop ¶
func Stop(name string, opts StopOptions) error
Stop sends a stop signal to a container without removing it.
func UnsupportedServiceKeys ¶ added in v0.6.0
func UnsupportedServiceKeys(svc types.ServiceConfig) []string
UnsupportedServiceKeys returns compose keys set on a service that apple-compose does not implement (or only partially implements).
func Up ¶
func Up(project string, svc types.ServiceConfig, opts UpOptions) error
Up starts a container for the given service (detached). If the container already exists and is running, it is skipped unless config changed or ForceRecreate is set. If it exists but is stopped, it is started without recreating unless recreate is needed.
func WaitForDependency ¶ added in v0.6.0
func WaitForDependency(project string, dep types.ServiceConfig, condition string, timeout time.Duration) error
WaitForDependency blocks until a dependency satisfies its depends_on condition.
func WaitHealthy ¶
WaitHealthy blocks until a service is ready: healthy if it defines a healthcheck, otherwise running.
func WarnContainerCLIVersion ¶ added in v0.6.0
func WarnContainerCLIVersion()
WarnContainerCLIVersion checks the installed container CLI once per process and prints warnings for unsupported versions or unexpected JSON output shapes.
Types ¶
type ContainerInfo ¶ added in v0.3.0
ContainerInfo holds basic info about a running container.
func ListContainersForProject ¶ added in v0.3.0
func ListContainersForProject(project string) ([]ContainerInfo, error)
ListContainersForProject returns all containers belonging to a project.
type ContainerRecord ¶ added in v0.5.0
ContainerRecord is a parsed entry from `container list --format json`.
func ListAllContainers ¶ added in v0.5.0
func ListAllContainers() ([]ContainerRecord, error)
ListAllContainers returns every container with apple-compose labels.
type StopOptions ¶ added in v0.5.0
type StopOptions struct {
Signal string // e.g. SIGTERM
Timeout int // seconds before SIGKILL; 0 uses container CLI default
}
StopOptions configures how a container is stopped (maps to container stop flags).
func StopOptionsFromService ¶ added in v0.5.0
func StopOptionsFromService(svc types.ServiceConfig) StopOptions
StopOptionsFromService maps compose stop_signal and stop_grace_period.