Documentation
¶
Overview ¶
Package dockerlib is the activity-and-resource library over docker on a machine: install the engine, run containers. All bodies execute inside the per-(agent × run) container on the machine — with the machine's docker socket under their feet; the run workflow only orchestrates.
The durable half of dockerlib: containers, volumes, and networks are ENTITY RECORDS — owned in the tree, cascaded, transferable to a stand — whose lifecycle activities run on the machine's own (agent × run) executor. The executor lives while these records do.
Index ¶
- Constants
- func Build(spec BuildSpec) activity.Call[BuildReport]
- func Container(ctx pipeline.Context, agent pipeline.Agent, spec Spec, ...) pipeline.Resource[Info]
- func Install() activity.Call[InstallReport]
- func Network(ctx pipeline.Context, agent pipeline.Agent, spec NetworkSpec, ...) pipeline.Resource[NetworkInfo]
- func Volume(ctx pipeline.Context, agent pipeline.Agent, spec volume.CreateOptions, ...) pipeline.Resource[VolumeInfo]
- type BuildReport
- type BuildSpec
- type Info
- type InstallReport
- type NetworkInfo
- type NetworkSpec
- type Spec
- type VolumeInfo
Constants ¶
const ( ContainerKind entity.KindName = "docker" VolumeKind entity.KindName = "docker-volume" NetworkKind entity.KindName = "docker-network" )
Entity kinds.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(spec BuildSpec) activity.Call[BuildReport]
Build assembles an image with the machine's own buildx — full BuildKit (cache export, multi-stage, secrets) with nothing wrapped: the CLI the machine already has (Install brings it) does the work, the digest comes back through --metadata-file, never log parsing.
func Container ¶
func Container(ctx pipeline.Context, agent pipeline.Agent, spec Spec, opts ...pipeline.ResourceOption) pipeline.Resource[Info]
Container declares a container on the agent's machine as an ORDINARY resource: an entity record in the tree — owned, cascaded, transferable to a stand. Its lifecycle runs on this agent's own executor, which lives while the record does.
func Install ¶
func Install() activity.Call[InstallReport]
Install brings the docker engine onto the machine — converging: an engine that is already there is reported, not reinstalled. A library verb is a Call: run it with pipelineactivity.Activity on one agent or pipelineactivity.ActivityAll on a selection.
func Network ¶
func Network(ctx pipeline.Context, agent pipeline.Agent, spec NetworkSpec, opts ...pipeline.ResourceOption) pipeline.Resource[NetworkInfo]
Network declares a docker network on the agent's machine as an ordinary resource — an owned entity record; it dies with its owner.
func Volume ¶
func Volume(ctx pipeline.Context, agent pipeline.Agent, spec volume.CreateOptions, opts ...pipeline.ResourceOption) pipeline.Resource[VolumeInfo]
Volume declares a docker volume on the agent's machine as an ordinary resource — an owned entity record; the data dies with its owner. The spec is docker's OWN type.
Types ¶
type BuildReport ¶
type BuildReport struct {
Digest string `json:"digest,omitempty"`
Tags []string `json:"tags,omitempty"`
}
BuildReport is the build's outcome: the immutable identity of what was built. The local image stays on the machine as cache — it is not a resource and owns nothing.
type BuildSpec ¶
type BuildSpec struct {
// Context is the build context directory.
Context string `json:"context"`
// File is the Dockerfile path; empty means <Context>/Dockerfile.
File string `json:"file,omitempty"`
// Tags to apply ("registry/name:tag").
Tags []string `json:"tags,omitempty"`
// Push pushes the tags after a successful build.
Push bool `json:"push,omitempty"`
// Target builds a specific stage.
Target string `json:"target,omitempty"`
// BuildArgs are --build-arg pairs.
BuildArgs map[string]string `json:"buildArgs,omitempty"`
// CacheFrom / CacheTo are buildx cache specs
// ("type=registry,ref=...").
CacheFrom []string `json:"cacheFrom,omitempty"`
CacheTo []string `json:"cacheTo,omitempty"`
}
BuildSpec describes one image build. Paths (Context, File) must be machine-valid — put the context under machine.Workspace() and this holds by construction (same absolute path in the container, on the machine, and for the daemon).
type Info ¶
type Info struct {
Id string `json:"id"`
}
Info is the output of a running container resource.
type InstallReport ¶
type InstallReport struct {
Version string `json:"version"`
// Installed is false when the engine was already there.
Installed bool `json:"installed"`
}
InstallReport is what Install returns.
type NetworkInfo ¶
NetworkInfo is the output of a network resource.
type NetworkSpec ¶
type NetworkSpec struct {
Name string `json:"name"`
Options network.CreateOptions `json:"options"`
}
NetworkSpec names a network with docker's own creation options.
type Spec ¶
type Spec struct {
Name string `json:"name"`
Config *container.Config `json:"config"`
Host *container.HostConfig `json:"host,omitempty"`
// Scrape is a prometheus metrics endpoint the container exposes
// (e.g. "http://localhost:9187/metrics"); the observation beat pulls
// it and ships the samples as this container's own metrics (Р-Н27).
Scrape string `json:"scrape,omitempty"`
}
Spec describes one container with docker's OWN types — structures their authors made, not ours.
type VolumeInfo ¶
type VolumeInfo struct {
Name string `json:"name"`
Mountpoint string `json:"mountpoint,omitempty"`
}
VolumeInfo is the output of a volume resource.