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 ¶
- func New(env core.Env, c *spec.Component) (any, error)
- type Compose
- type Options
- type Runtime
- func (r *Runtime) Actions() []core.Action
- func (r *Runtime) Deploy(ctx context.Context, s *spec.Service, rel core.Release) error
- func (r *Runtime) Discover(ctx context.Context) ([]core.Workload, error)
- func (r *Runtime) Exec(ctx context.Context, s *spec.Service, o core.ExecOptions) error
- func (r *Runtime) Forward(ctx context.Context, t core.Target) (string, error)
- func (r *Runtime) LoadImage(ctx context.Context, image string) error
- func (r *Runtime) Logs(ctx context.Context, s *spec.Service, o core.LogOptions) (<-chan core.LogLine, error)
- func (r *Runtime) Registry() string
- func (r *Runtime) Restart(ctx context.Context, s *spec.Service) error
- func (r *Runtime) Scale(ctx context.Context, s *spec.Service, n int) error
- func (r *Runtime) Start(ctx context.Context, s *spec.Service) error
- func (r *Runtime) Status(ctx context.Context, s *spec.Service) (core.Status, error)
- func (r *Runtime) StatusAll(ctx context.Context, svcs []*spec.Service) ([]core.Status, error)
- func (r *Runtime) Stop(ctx context.Context, s *spec.Service) error
- type Section
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
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 ¶
func (*Runtime) Forward ¶
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 ¶
LoadImage copies a locally built image to a remote daemon; the local daemon already has it.
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"`
}
Click to show internal directories.
Click to hide internal directories.