Documentation
¶
Overview ¶
Package convert turns a compose project into what the Compose orchestrator creates on the Docker Engine: the create options of each container, its networks and volumes, and the state to wait for, the way docker compose does. It only computes: creating the objects is the orchestrator's job.
Index ¶
- Constants
- func Conditions(project *types.Project) map[string]Condition
- func ContainerName(stack, service string, number int) string
- func Network(key string, network types.NetworkConfig, base map[string]string) (docker.NetworkSpec, error)
- func Volume(key string, config types.VolumeConfig, base map[string]string) *volume.Volume
- type Condition
- type File
- type ServiceSpec
Constants ¶
const ( ProjectLabel = "com.docker.compose.project" ServiceLabel = "com.docker.compose.service" NumberLabel = "com.docker.compose.container-number" OneoffLabel = "com.docker.compose.oneoff" ConfigHashLabel = "com.docker.compose.config-hash" NetworkLabel = "com.docker.compose.network" VolumeLabel = "com.docker.compose.volume" )
Labels docker compose puts on what it creates.
Variables ¶
This section is empty.
Functions ¶
func Conditions ¶
Conditions gives each service the strongest state its dependants ask for. A service nothing depends on is waited for until it runs, and healthy when it has a healthcheck, as docker compose up --wait.
func ContainerName ¶
ContainerName is the name of a service's container, as docker compose names it: <project>-<service>-<number>.
func Network ¶
func Network(key string, network types.NetworkConfig, base map[string]string) (docker.NetworkSpec, error)
Network converts a compose network.
Types ¶
type Condition ¶
type Condition string
Condition is the state a container must reach before the services depending on it start.
type File ¶
type File struct {
Path string
Data []byte `json:"-"`
Digest digest.Digest
UID, GID int
Mode os.FileMode
}
File is a config or a secret, copied into each container before it starts.
type ServiceSpec ¶
type ServiceSpec struct {
Name string
Replicas int
Config *container.Config
Host *container.HostConfig
Networking *network.NetworkingConfig
Platform *ocispec.Platform
Files []File
// Hash identifies the spec: a container whose hash differs is recreated.
Hash string
// Wait is the state the containers must reach before the next level starts.
Wait Condition
}
ServiceSpec is what every container of a compose service is created from.
func Service ¶
func Service(project *types.Project, service types.ServiceConfig, base map[string]string) (*ServiceSpec, error)
Service converts a compose service into what each of its containers is created from.