dockerengine

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Overview

Package dockerengine is the shared runtime for Docker-API protocols. The docker, swarm, and podman plugins all talk to a Docker-compatible daemon over the moby client, so the session, streaming channels, row mapping, pagination, and generic route handlers live here once. Each plugin supplies only its manifest and the route wiring (IDs, permissions, paths).

Index

Constants

View Source
const ComposeProjectLabel = "com.docker.compose.project"

ComposeProjectLabel groups containers/volumes into a Compose project.

View Source
const OverviewKind = "overview"

OverviewKind is the singleton resource kind backing an engine overview dashboard. Each engine plugin declares it in its own manifest.

Variables

This section is empty.

Functions

func BuildImage

func BuildImage(rc *plugin.RequestContext) (any, error)

BuildImage builds an image from an inline Dockerfile, tagging the result.

func CommitContainer added in v0.1.1

func CommitContainer(rc *plugin.RequestContext) (any, error)

func CommitContainerSchema added in v0.1.1

func CommitContainerSchema() *plugin.Schema

func ComposeContainers

func ComposeContainers(rc *plugin.RequestContext) (any, error)

func ComposeDown

func ComposeDown(rc *plugin.RequestContext) (any, error)

ComposeDown stops and removes every container belonging to a Compose project.

func ComposeOverview

func ComposeOverview(rc *plugin.RequestContext) (any, error)

func ComposeOverviewDetailConfig added in v0.1.1

func ComposeOverviewDetailConfig() plugin.ObjectDetailConfig

func ComposeServices

func ComposeServices(rc *plugin.RequestContext) (any, error)

func ComposeSeverities added in v0.1.1

func ComposeSeverities() map[string]plugin.Severity

func ComposeUp

func ComposeUp(rc *plugin.RequestContext) (any, error)

ComposeUp starts every container belonging to a Compose project. The daemon has no Compose engine, so this orchestrates over the project's existing (label-derived) containers rather than reading a Compose file.

func Connect

func Connect(ctx context.Context, cfg plugin.ConnectConfig, defaultSocket string) (plugin.Session, error)

Connect dials the daemon for cfg's transport. defaultSocket is the unix socket used when none is configured (e.g. /var/run/docker.sock, /run/podman/podman.sock).

func ConnectNetwork

func ConnectNetwork(rc *plugin.RequestContext) (any, error)

func ContainerEnv

func ContainerEnv(rc *plugin.RequestContext) (any, error)

func ContainerFileDelete added in v0.1.1

func ContainerFileDelete(rc *plugin.RequestContext) (any, error)

func ContainerFileDownload added in v0.1.1

func ContainerFileDownload(rc *plugin.RequestContext) (any, error)

func ContainerFileMkdir added in v0.1.1

func ContainerFileMkdir(rc *plugin.RequestContext) (any, error)

func ContainerFileRead added in v0.1.1

func ContainerFileRead(rc *plugin.RequestContext) (any, error)

func ContainerFileRename added in v0.1.1

func ContainerFileRename(rc *plugin.RequestContext) (any, error)

func ContainerFileUpload added in v0.1.1

func ContainerFileUpload(rc *plugin.RequestContext) (any, error)

func ContainerFileUploadSchema added in v0.1.1

func ContainerFileUploadSchema() *plugin.Schema

ContainerFileUploadSchema declares the multipart upload input.

func ContainerFileWrite added in v0.1.1

func ContainerFileWrite(rc *plugin.RequestContext) (any, error)

func ContainerFilesList added in v0.1.1

func ContainerFilesList(rc *plugin.RequestContext) (any, error)

func ContainerFilesTab added in v0.1.1

func ContainerFilesTab(prefix string) plugin.Panel

ContainerFilesTab builds a generic file browser over a running container, backed by exec. prefix is the route-ID namespace (e.g. "docker.container"); each plugin wires the concrete route IDs so the shared handlers stay plugin-agnostic.

func ContainerMounts added in v0.1.1

func ContainerMounts(rc *plugin.RequestContext) (any, error)

func ContainerOpenPorts added in v0.1.1

func ContainerOpenPorts(rc *plugin.RequestContext) (any, error)

ContainerOpenPorts returns the port choices used by ContainerOpenSchema.

func ContainerOpenSchema added in v0.1.1

func ContainerOpenSchema(optionsRouteID string) *plugin.Schema

ContainerOpenSchema asks the renderer to select a reachable port before opening a browser proxy URL.

func ContainerOverview

func ContainerOverview(rc *plugin.RequestContext) (any, error)

func ContainerOverviewDetailConfig added in v0.1.1

func ContainerOverviewDetailConfig() plugin.ObjectDetailConfig

func ContainerProcesses added in v0.1.1

func ContainerProcesses(rc *plugin.RequestContext) (any, error)

func ContainerProxyURL

func ContainerProxyURL(rc *plugin.RequestContext) (any, error)

ContainerProxyURL returns the gateway URL that proxies to a container's web port for an "Open in browser" link, picking a likely web port when none given.

func ContainerStats added in v0.1.1

func ContainerStats(rc *plugin.RequestContext, stream plugin.ClientStream) error

func ContainerStatsConfig added in v0.1.1

func ContainerStatsConfig() plugin.MetricsConfig

func CreateContainer

func CreateContainer(rc *plugin.RequestContext) (any, error)

func CreateContainerSchema

func CreateContainerSchema() *plugin.Schema

func CreateNetwork

func CreateNetwork(rc *plugin.RequestContext) (any, error)

func CreateVolume

func CreateVolume(rc *plugin.RequestContext) (any, error)

func DisconnectNetwork

func DisconnectNetwork(rc *plugin.RequestContext) (any, error)

func DockerErr

func DockerErr(err error) error

DockerErr maps a moby client error to a platform sentinel so the response layer can pick the right status code.

func DockerEventStream added in v0.1.1

func DockerEventStream(rc *plugin.RequestContext, client plugin.ClientStream) error

func DockerObjectWatch added in v0.1.1

func DockerObjectWatch(rc *plugin.RequestContext, client plugin.ClientStream) error

func DockerTimelineWatch added in v0.1.1

func DockerTimelineWatch(rc *plugin.RequestContext, client plugin.ClientStream) error

func EngineShellStream added in v0.1.1

func EngineShellStream(rc *plugin.RequestContext, client plugin.ClientStream) error

func EventsTimeline added in v0.1.1

func EventsTimeline(rc *plugin.RequestContext) (any, error)

func EventsTimelineConfig added in v0.1.1

func EventsTimelineConfig(watch *plugin.DataSource) plugin.TimelineConfig

func ExecSchema

func ExecSchema() *plugin.Schema

func ExecStream

func ExecStream(rc *plugin.RequestContext, client plugin.ClientStream) error

func ImageBuildSchema

func ImageBuildSchema() *plugin.Schema

func ImageHistory added in v0.1.1

func ImageHistory(rc *plugin.RequestContext) (any, error)

func ImageHistoryColumns added in v0.1.1

func ImageHistoryColumns() []plugin.Column

func ImageOverview

func ImageOverview(rc *plugin.RequestContext) (any, error)

func ImageOverviewDetailConfig added in v0.1.1

func ImageOverviewDetailConfig() plugin.ObjectDetailConfig

func ImagePullSchema

func ImagePullSchema() *plugin.Schema

func ImagePushSchema

func ImagePushSchema() *plugin.Schema

func ImageTagSchema

func ImageTagSchema() *plugin.Schema

func InspectContainer

func InspectContainer(rc *plugin.RequestContext) (any, error)

func InspectImage

func InspectImage(rc *plugin.RequestContext) (any, error)

func InspectNetwork

func InspectNetwork(rc *plugin.RequestContext) (any, error)

func InspectVolume

func InspectVolume(rc *plugin.RequestContext) (any, error)

func KillContainer

func KillContainer(rc *plugin.RequestContext) (any, error)

KillContainer sends a signal to a container, defaulting to SIGKILL.

func KillContainerSchema

func KillContainerSchema() *plugin.Schema

func ListCompose

func ListCompose(rc *plugin.RequestContext) (any, error)

func ListContainers

func ListContainers(rc *plugin.RequestContext) (any, error)

func ListImages

func ListImages(rc *plugin.RequestContext) (any, error)

func ListNetworks

func ListNetworks(rc *plugin.RequestContext) (any, error)

func ListVolumes

func ListVolumes(rc *plugin.RequestContext) (any, error)

func LogsSchema

func LogsSchema() *plugin.Schema

func LogsStream

func LogsStream(rc *plugin.RequestContext, client plugin.ClientStream) error

func MetricsLoop

func MetricsLoop(rc *plugin.RequestContext, stream plugin.ClientStream, frame func(context.Context) map[string]any) error

MetricsLoop streams frames on a fixed cadence until the client or request context closes. A frame builder that can't reach its data returns what it has.

func NetworkConnectSchema

func NetworkConnectSchema(containersRouteID string) *plugin.Schema

func NetworkCreateSchema

func NetworkCreateSchema() *plugin.Schema

func NetworkDisconnectSchema

func NetworkDisconnectSchema(containersRouteID string) *plugin.Schema

func NetworkOverview

func NetworkOverview(rc *plugin.RequestContext) (any, error)

func NetworkOverviewDetailConfig added in v0.1.1

func NetworkOverviewDetailConfig() plugin.ObjectDetailConfig

func NetworkPortColumns added in v0.1.1

func NetworkPortColumns() []plugin.Column

func NetworkPorts added in v0.1.1

func NetworkPorts(rc *plugin.RequestContext) (any, error)

func NetworkTopology added in v0.1.1

func NetworkTopology(rc *plugin.RequestContext) (any, error)

func OverviewList

func OverviewList(_ *plugin.RequestContext) (any, error)

OverviewList is the single row backing the overview ResourceType.

func OverviewMetrics

func OverviewMetrics(rc *plugin.RequestContext, stream plugin.ClientStream) error

OverviewMetrics streams live counts of the engine's containers, images, volumes, and networks.

func OverviewMetricsConfig

func OverviewMetricsConfig() plugin.MetricsConfig

OverviewMetricsConfig declares the environment count tiles.

func OverviewRef

func OverviewRef() *plugin.ResourceIdentity

OverviewRef opens the overview dashboard from a tree group.

func PageRows

func PageRows(rc *plugin.RequestContext, rows []Row) (plugin.Page[Row], error)

PageRows applies the request's filter, sort, and cursor pagination to rows.

func PauseContainer

func PauseContainer(rc *plugin.RequestContext) (any, error)

func PodmanNetworkCreateSchema added in v0.1.1

func PodmanNetworkCreateSchema() *plugin.Schema

func ProcessColumns added in v0.1.1

func ProcessColumns() []plugin.Column

func PruneContainers

func PruneContainers(rc *plugin.RequestContext) (any, error)

PruneContainers removes all stopped containers.

func PruneImages

func PruneImages(rc *plugin.RequestContext) (any, error)

PruneImages removes dangling images.

func PruneNetworks

func PruneNetworks(rc *plugin.RequestContext) (any, error)

PruneNetworks removes unused networks.

func PruneVolumes

func PruneVolumes(rc *plugin.RequestContext) (any, error)

PruneVolumes removes unused volumes.

func PullImage

func PullImage(rc *plugin.RequestContext) (any, error)

PullImage pulls an image by reference, waiting for the pull to finish.

func PushImage

func PushImage(rc *plugin.RequestContext) (any, error)

PushImage pushes an image reference to a registry, optionally authenticating.

func RawOrValue

func RawOrValue(raw json.RawMessage, value any) (any, error)

RawOrValue returns the daemon's raw inspect JSON when present, falling back to the typed value. Plugin packages use it for their own inspect routes.

func RedeployContainer added in v0.1.1

func RedeployContainer(rc *plugin.RequestContext) (any, error)

func RedeployContainerSchema added in v0.1.1

func RedeployContainerSchema() *plugin.Schema

func RemoveContainer

func RemoveContainer(rc *plugin.RequestContext) (any, error)

func RemoveImage

func RemoveImage(rc *plugin.RequestContext) (any, error)

func RemoveNetwork

func RemoveNetwork(rc *plugin.RequestContext) (any, error)

func RemoveVolume

func RemoveVolume(rc *plugin.RequestContext) (any, error)

func RenameContainer

func RenameContainer(rc *plugin.RequestContext) (any, error)

func RenameContainerSchema

func RenameContainerSchema() *plugin.Schema

func RestartContainer

func RestartContainer(rc *plugin.RequestContext) (any, error)

func ShortID

func ShortID(id string) string

ShortID trims a sha256 prefix and truncates to 12 chars for display.

func StartContainer

func StartContainer(rc *plugin.RequestContext) (any, error)

func StateSeverities

func StateSeverities() map[string]plugin.Severity

StateSeverities colors a container "state" badge by value.

func StopContainer

func StopContainer(rc *plugin.RequestContext) (any, error)

func TagImage

func TagImage(rc *plugin.RequestContext) (any, error)

func TreeCompose

func TreeCompose(rc *plugin.RequestContext) (any, error)

func TreeContainers

func TreeContainers(rc *plugin.RequestContext) (any, error)

func TreeFromRows

func TreeFromRows(rc *plugin.RequestContext, kind string, fn func(*plugin.RequestContext) (any, error)) (any, error)

TreeFromRows turns a list handler's Page[Row] into sidebar tree nodes, using each row's "ref" to build the node. fn is typically one of the List* handlers.

func TreeImages

func TreeImages(rc *plugin.RequestContext) (any, error)

func TreeNetworks

func TreeNetworks(rc *plugin.RequestContext) (any, error)

func TreeVolumes

func TreeVolumes(rc *plugin.RequestContext) (any, error)

func UnpauseContainer

func UnpauseContainer(rc *plugin.RequestContext) (any, error)

func UsageSeverities added in v0.1.1

func UsageSeverities() map[string]plugin.Severity

func VolumeBackup added in v0.1.1

func VolumeBackup(rc *plugin.RequestContext) (any, error)

func VolumeBackupURL added in v0.1.1

func VolumeBackupURL(rc *plugin.RequestContext) (any, error)

func VolumeBackupURLFor added in v0.1.1

func VolumeBackupURLFor(routeID string) plugin.Handler

func VolumeCreateSchema

func VolumeCreateSchema() *plugin.Schema

func VolumeOverview

func VolumeOverview(rc *plugin.RequestContext) (any, error)

func VolumeOverviewDetailConfig added in v0.1.1

func VolumeOverviewDetailConfig() plugin.ObjectDetailConfig

func WatchEvents

func WatchEvents(rc *plugin.RequestContext, client plugin.ClientStream) error

func WhenState

func WhenState(states ...string) *plugin.Condition

WhenState gates an action on the row's "state" field.

Types

type ActionResult

type ActionResult struct {
	OK bool `json:"ok"`
}

type BuildResult

type BuildResult struct {
	OK     bool   `json:"ok"`
	Tag    string `json:"tag"`
	Output string `json:"output,omitempty"`
}

BuildResult carries the collected daemon build log back to the generic toast.

type CommitContainerResult added in v0.1.1

type CommitContainerResult struct {
	OK      bool   `json:"ok"`
	ImageID string `json:"imageId"`
}

type ComposeResult

type ComposeResult struct {
	OK        bool `json:"ok"`
	Affected  int  `json:"affected"`
	Succeeded int  `json:"succeeded"`
}

ComposeResult summarises how many of a project's containers an op touched.

type CreateContainerRequest

type CreateContainerRequest struct {
	Name           string `json:"name"`
	Image          string `json:"image" validate:"required"`
	Pull           *bool  `json:"pull"`
	Start          *bool  `json:"start"`
	Command        string `json:"command"`
	Entrypoint     string `json:"entrypoint"`
	User           string `json:"user"`
	WorkingDir     string `json:"working_dir"`
	Env            string `json:"env"`
	Ports          string `json:"ports"`
	Binds          string `json:"binds"`
	Network        string `json:"network"`
	Restart        string `json:"restart"`
	RestartRetries int    `json:"restart_retries"`
	TTY            bool   `json:"tty"`
	OpenStdin      bool   `json:"open_stdin"`
}

type CreateContainerResult

type CreateContainerResult struct {
	OK       bool     `json:"ok"`
	ID       string   `json:"id"`
	Name     string   `json:"name,omitempty"`
	Started  bool     `json:"started"`
	Warnings []string `json:"warnings,omitempty"`
}

type PruneResult

type PruneResult struct {
	OK             bool   `json:"ok"`
	Deleted        int    `json:"deleted"`
	SpaceReclaimed uint64 `json:"spaceReclaimed"`
}

PruneResult summarises a prune sweep for the generic action toast.

type RedeployContainerResult added in v0.1.1

type RedeployContainerResult struct {
	OK bool   `json:"ok"`
	ID string `json:"id"`
}

type Row

type Row = plugin.TableRow

Row is one generic record returned by the shared handlers.

func ContainerRows

func ContainerRows(items []container.Summary) []Row

func ImageRows

func ImageRows(items []image.Summary) []Row

func NetworkRows

func NetworkRows(items []network.Summary) []Row

func VolumeRows

func VolumeRows(items []volume.Volume, refCounts, sizes map[string]int64) []Row

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is a live connection to one Docker-compatible daemon. It is created per connection and holds all per-connection state; plugins stay stateless.

func Unwrap

func Unwrap(sess plugin.Session) (*Session, error)

Unwrap recovers the engine Session from a plugin.Session, transparently looking through a wrapper (e.g. the recording layer) that exposes Session().

func (*Session) Client

func (s *Session) Client() *dockerclient.Client

Client exposes the moby client so plugin-specific handlers (swarm services, nodes, tasks; podman pods) can issue calls the shared handlers don't cover.

func (*Session) Close

func (s *Session) Close() error

func (*Session) HTTPClient

func (s *Session) HTTPClient() *http.Client

HTTPClient exposes the daemon-dialing HTTP client for Podman's libpod-only endpoints.

func (*Session) HealthCheck

func (s *Session) HealthCheck(ctx context.Context) error

func (*Session) OpenChannel

func (s *Session) OpenChannel(ctx context.Context, req plugin.ChannelRequest) (plugin.Channel, error)

func (*Session) ServeHTTPProxy

func (s *Session) ServeHTTPProxy(w http.ResponseWriter, r *http.Request)

ServeHTTPProxy reverse-proxies a browser to a container's or swarm service's web port, via `/{container|service}/{id}/{port}/{rest...}`.

type SessionCache added in v0.1.1

type SessionCache[T any] struct {
	TTL time.Duration
	// contains filtered or unexported fields
}

SessionCache memoizes one expensive daemon lookup per session behind a TTL and a single-flight lock, so the panels open on a connection share one round trip instead of each issuing their own.

func (*SessionCache[T]) Get added in v0.1.1

func (c *SessionCache[T]) Get(s *Session, load func() (T, error)) (T, error)

Get returns the cached value, loading it when older than the TTL.

func (*SessionCache[T]) Refresh added in v0.1.1

func (c *SessionCache[T]) Refresh(s *Session, load func() (T, error)) (T, error)

Refresh reloads the value regardless of its age, unless another caller has already refreshed it while this one waited.

Jump to

Keyboard shortcuts

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