Documentation
¶
Index ¶
- func NormaliseArchitecture(arch string) string
- type ContainerConfig
- type ImagePullProgress
- type LogStreamOptions
- type RuntimeContainer
- func (rc *RuntimeContainer) CheckAvailability(ctx context.Context) error
- func (rc *RuntimeContainer) CleanupStale(ctx context.Context, containerName string) error
- func (rc *RuntimeContainer) CreateAndStart(ctx context.Context, cfg *ContainerConfig) (string, error)
- func (r *RuntimeContainer) DaemonArchitecture(ctx context.Context) (string, error)
- func (rc *RuntimeContainer) EnsureImage(ctx context.Context, img string, progress chan<- ImagePullProgress) error
- func (rc *RuntimeContainer) IsRunning(ctx context.Context, containerID string) (bool, error)
- func (rc *RuntimeContainer) RestartContainer(ctx context.Context, containerID string) error
- func (rc *RuntimeContainer) Stop(ctx context.Context, containerID string) error
- func (rc *RuntimeContainer) StreamLogs(ctx context.Context, containerID string) (io.ReadCloser, error)
- func (rc *RuntimeContainer) StreamLogsWithOptions(ctx context.Context, containerID string, opts LogStreamOptions) (io.ReadCloser, error)
- type RuntimeContainerManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormaliseArchitecture ¶
NormaliseArchitecture maps the architecture names Docker reports onto GOARCH names.
Docker reports the kernel's own spelling (uname -m), which is not what Go calls the same architectures.
Types ¶
type ContainerConfig ¶
type ContainerConfig struct {
Image string
ContainerName string
Cmd []string
HostPort string
ContainerPort string
AppDir string
EnvVars map[string]string
Binds []string
NetworkName string
}
ContainerConfig holds the configuration for creating a runtime container.
type ImagePullProgress ¶
ImagePullProgress reports progress of a Docker image pull operation.
type LogStreamOptions ¶
type LogStreamOptions struct {
Follow bool
Tail string // "all" or a number like "100"
Since string // RFC3339 timestamp or relative duration
Timestamps bool
}
LogStreamOptions configures container log streaming with filtering support.
type RuntimeContainer ¶
type RuntimeContainer struct {
// contains filtered or unexported fields
}
RuntimeContainer implements RuntimeContainerManager using the Docker Engine API.
func NewRuntimeContainer ¶
func NewRuntimeContainer(logger *zap.Logger) (*RuntimeContainer, error)
NewRuntimeContainer creates a new Docker client for managing runtime containers.
func (*RuntimeContainer) CheckAvailability ¶
func (rc *RuntimeContainer) CheckAvailability(ctx context.Context) error
func (*RuntimeContainer) CleanupStale ¶
func (rc *RuntimeContainer) CleanupStale( ctx context.Context, containerName string, ) error
func (*RuntimeContainer) CreateAndStart ¶
func (rc *RuntimeContainer) CreateAndStart( ctx context.Context, cfg *ContainerConfig, ) (string, error)
func (*RuntimeContainer) DaemonArchitecture ¶
func (r *RuntimeContainer) DaemonArchitecture(ctx context.Context) (string, error)
DaemonArchitecture reports the architecture the Docker daemon runs containers at, as a GOARCH name.
Read from the daemon rather than taken from the CLI's own GOARCH, because the two are often different. A remote context, or a Linux VM on an arm64 Mac, runs containers at an architecture the client is not built for, and a handlers executable cross-compiled for the wrong one is a valid file the kernel refuses to exec, which the supervisor reports as a bare ENOEXEC.
func (*RuntimeContainer) EnsureImage ¶
func (rc *RuntimeContainer) EnsureImage( ctx context.Context, img string, progress chan<- ImagePullProgress, ) error
func (*RuntimeContainer) RestartContainer ¶
func (rc *RuntimeContainer) RestartContainer( ctx context.Context, containerID string, ) error
func (*RuntimeContainer) Stop ¶
func (rc *RuntimeContainer) Stop(ctx context.Context, containerID string) error
func (*RuntimeContainer) StreamLogs ¶
func (rc *RuntimeContainer) StreamLogs( ctx context.Context, containerID string, ) (io.ReadCloser, error)
func (*RuntimeContainer) StreamLogsWithOptions ¶
func (rc *RuntimeContainer) StreamLogsWithOptions( ctx context.Context, containerID string, opts LogStreamOptions, ) (io.ReadCloser, error)
type RuntimeContainerManager ¶
type RuntimeContainerManager interface {
CheckAvailability(ctx context.Context) error
EnsureImage(ctx context.Context, image string, progress chan<- ImagePullProgress) error
CreateAndStart(ctx context.Context, config *ContainerConfig) (string, error)
StreamLogs(ctx context.Context, containerID string) (io.ReadCloser, error)
StreamLogsWithOptions(ctx context.Context, containerID string, opts LogStreamOptions) (io.ReadCloser, error)
RestartContainer(ctx context.Context, containerID string) error
Stop(ctx context.Context, containerID string) error
IsRunning(ctx context.Context, containerID string) (bool, error)
CleanupStale(ctx context.Context, containerName string) error
}
RuntimeContainerManager manages Docker containers for the Celerity dev runtime.