backend

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelProject = "com.apple-compose.project"
	LabelService = "com.apple-compose.service"
)

Label keys stamped on every container we start.

View Source
const LabelConfigHash = "com.apple-compose.config-hash"
View Source
const LabelHostsHash = "com.apple-compose.hosts-hash"

Variables

This section is empty.

Functions

func ContainerName

func ContainerName(project, service string) string

ContainerName returns the canonical name for a service container.

func ContainerStatus added in v0.3.0

func ContainerStatus(name string) (string, error)

ContainerStatus returns the status of a container by name.

func DeleteNetwork

func DeleteNetwork(project string)

DeleteNetwork removes the project network.

func Down

func Down(name string, opts StopOptions) error

Down stops and removes a container.

func EnsureNetwork

func EnsureNetwork(project string) error

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 Logs

func Logs(name string, follow bool) error

Logs tails logs for a named container.

func NetworkName

func NetworkName(project string) string

NetworkName returns the shared network name for a project.

func PS

func PS(project string) error

PS lists containers belonging to the given project, formatted as a table.

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

func RemoveNamedVolumes(project string) error

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 Start

func Start(name string) error

Start starts a previously stopped container.

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

func WaitHealthy(project string, svc types.ServiceConfig, timeout time.Duration) error

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.

func WarnUnsupportedKeys added in v0.6.0

func WarnUnsupportedKeys(w io.Writer, project *types.Project)

WarnUnsupportedKeys prints a stderr warning for each unsupported key found in the project.

Types

type ContainerInfo added in v0.3.0

type ContainerInfo struct {
	Name    string
	Service string
	Status  string
	Image   string
}

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

type ContainerRecord struct {
	Status  string
	Project string
	Service string
}

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.

type UpOptions added in v0.6.0

type UpOptions struct {
	ForceRecreate bool
}

UpOptions configures how Up handles existing containers.

Jump to

Keyboard shortcuts

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