Help us shape the future of Go! Take the 2026 Go Developer Survey

docker

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package docker runs each service as labelled containers on one network, so services reach each other by service name. Only the first replica publishes ports, on 127.0.0.1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(env core.Env, c *spec.Component) (any, error)

Types

type Compose

type Compose struct {
	Project string `yaml:"project"`
	// Files are the compose files (from the project directory), base first.
	Files []string `yaml:"files"`
}

type Options

type Options struct {
	Network  string            `yaml:"network"`
	Registry string            `yaml:"registry"`
	Env      map[string]string `yaml:"env"`
	// Publish exposes the first replica's ports on 127.0.0.1 (random host ports unless docker.publish sets them);
	// off, rig reaches services by container IP.
	Publish *bool `yaml:"publish"`
	// Host is the daemon (ssh://user@server, tcp://server:2376) and Context a docker context; rig's
	// docker calls use them, health checks and forwards reach an ssh daemon's containers through ssh -L.
	Host    string `yaml:"host"`
	Context string `yaml:"context"`
	// Compose hands the services to a docker compose project: rig finds its containers by compose's
	// labels and starts, stops, scales and deploys through docker compose, so the compose file stays
	// the one definition.
	Compose *Compose `yaml:"compose"`
}

type Runtime

type Runtime struct {
	localhost.Host
	// contains filtered or unexported fields
}

func (*Runtime) Actions

func (r *Runtime) Actions() []core.Action

func (*Runtime) Deploy

func (r *Runtime) Deploy(ctx context.Context, s *spec.Service, rel core.Release) error

func (*Runtime) Discover

func (r *Runtime) Discover(ctx context.Context) ([]core.Workload, error)

func (*Runtime) Exec

func (r *Runtime) Exec(ctx context.Context, s *spec.Service, o core.ExecOptions) error

func (*Runtime) Forward

func (r *Runtime) Forward(ctx context.Context, t core.Target) (string, error)

Forward returns the published port, or else the container's address on its network; answers are cached briefly since health checks ask on every status.

func (*Runtime) LoadImage

func (r *Runtime) LoadImage(ctx context.Context, image string) error

LoadImage copies a locally built image to a remote daemon; the local daemon already has it.

func (*Runtime) Logs

func (r *Runtime) Logs(ctx context.Context, s *spec.Service, o core.LogOptions) (<-chan core.LogLine, error)

func (*Runtime) Registry

func (r *Runtime) Registry() string

func (*Runtime) Restart

func (r *Runtime) Restart(ctx context.Context, s *spec.Service) error

func (*Runtime) Scale

func (r *Runtime) Scale(ctx context.Context, s *spec.Service, n int) error

func (*Runtime) Start

func (r *Runtime) Start(ctx context.Context, s *spec.Service) error

func (*Runtime) Status

func (r *Runtime) Status(ctx context.Context, s *spec.Service) (core.Status, error)

func (*Runtime) StatusAll

func (r *Runtime) StatusAll(ctx context.Context, svcs []*spec.Service) ([]core.Status, error)

StatusAll lists this machine's containers once and answers for every service from that list.

func (*Runtime) Stop

func (r *Runtime) Stop(ctx context.Context, s *spec.Service) error

type Section

type Section struct {
	Image     string            `yaml:"image"`
	Command   []string          `yaml:"command"`
	Args      []string          `yaml:"args"`
	Volumes   []string          `yaml:"volumes"`
	Publish   map[string]int    `yaml:"publish"` // service port name -> host port
	ExtraArgs []string          `yaml:"extra_args"`
	Labels    map[string]string `yaml:"labels"`
	// Container adopts an existing container by name (one made by docker compose, say): rig starts
	// and stops it but never removes or recreates it.
	Container string `yaml:"container"`
	// Bind is the host address published ports listen on (default 127.0.0.1; 0.0.0.0 lets a kind
	// cluster reach a shared service).
	Bind string `yaml:"bind"`
}

Jump to

Keyboard shortcuts

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