compose

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package compose loads docker-compose projects into the IR.

The compose-spec loader does the parsing, so QuadDoc inherits its handling of interpolation, extends, merge order, and the rest. What this package adds is the mapping onto Quadlet's model, and honesty about what does not map: an unsupported key produces a finding, never a silent drop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Service string
	// Condition is `service_started`, `service_healthy`, or
	// `service_completed_successfully`.
	Condition string
}

Dependency is one `depends_on` edge.

type EnvVar

type EnvVar struct {
	Name  string
	Value string
}

EnvVar is one environment assignment.

type HealthCheck

type HealthCheck struct {
	Test        []string
	Interval    string
	Timeout     string
	StartPeriod string
	Retries     int
	Disabled    bool
}

HealthCheck is a compose healthcheck.

type Mount

type Mount struct {
	// Type is `bind`, `volume`, or `tmpfs`.
	Type string
	// Source is an absolute host path for a bind, or a volume name.
	Source string
	Target string
	// ReadOnly is the `:ro` flag.
	ReadOnly bool
	// SELinux carries a `z` or `Z` if the compose file already set one.
	SELinux string
}

Mount is one volume entry, already resolved by the compose loader.

type Network

type Network struct {
	Name     string
	Driver   string
	Internal bool
	Labels   map[string]string
	External bool
	// Subnets are the configured IPAM subnets.
	Subnets []string
	Gateway string
}

Network is a declared network.

type Port

type Port struct {
	HostIP    string
	Published string
	Target    int
	Protocol  string
}

Port is one published port.

func (Port) PublishedPort

func (p Port) PublishedPort() string

PublishedPort renders a port for `PublishPort=`.

type Project

type Project struct {
	// Name is the compose project name, used to name the generated network.
	Name string
	// Services are the compose services, sorted by name for determinism.
	Services []Service
	// Volumes are the declared named volumes, sorted.
	Volumes []Volume
	// Networks are the declared networks, sorted.
	Networks []Network
	// Unsupported records compose features that have no faithful Quadlet
	// translation, so they can be reported rather than dropped.
	Unsupported []Unsupported
	// WorkingDir is the directory the compose file was loaded from.
	WorkingDir string
}

Project is a loaded compose project, together with what could not be translated.

func Load

func Load(path string) (*Project, error)

Load reads a compose file and normalises it.

type Service

type Service struct {
	Name        string
	Image       string
	Command     []string
	Entrypoint  []string
	User        string
	WorkingDir  string
	Hostname    string
	Restart     string
	Environment []EnvVar
	Volumes     []Mount
	Ports       []Port
	Networks    []string
	DependsOn   []Dependency
	HealthCheck *HealthCheck
	CapAdd      []string
	CapDrop     []string
	Devices     []string
	DNS         []string
	Labels      map[string]string
	GroupAdd    []string
	ReadOnly    bool
	Privileged  bool
	ShmSize     string
	StopSignal  string
	Sysctls     map[string]string
	Tmpfs       []string
}

Service is one compose service.

type Unsupported

type Unsupported struct {
	// Service is the service it appeared on, empty for a top-level key.
	Service string
	// Key is the compose key, e.g. `build`.
	Key string
	// Reason explains why it cannot be translated, and what to do instead.
	Reason string
}

Unsupported is a compose feature with no faithful Quadlet translation.

type Volume

type Volume struct {
	Name     string
	Driver   string
	Options  map[string]string
	Labels   map[string]string
	External bool
}

Volume is a declared named volume.

Jump to

Keyboard shortcuts

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