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
- func BuildImage(rc *plugin.RequestContext) (any, error)
- func ComposeContainers(rc *plugin.RequestContext) (any, error)
- func ComposeDown(rc *plugin.RequestContext) (any, error)
- func ComposeOverview(rc *plugin.RequestContext) (any, error)
- func ComposeServices(rc *plugin.RequestContext) (any, error)
- func ComposeUp(rc *plugin.RequestContext) (any, error)
- func Connect(ctx context.Context, cfg plugin.ConnectConfig, defaultSocket string) (plugin.Session, error)
- func ConnectNetwork(rc *plugin.RequestContext) (any, error)
- func ContainerEnv(rc *plugin.RequestContext) (any, error)
- func ContainerOverview(rc *plugin.RequestContext) (any, error)
- func ContainerProxyURL(rc *plugin.RequestContext) (any, error)
- func CreateContainer(rc *plugin.RequestContext) (any, error)
- func CreateContainerSchema() *plugin.Schema
- func CreateNetwork(rc *plugin.RequestContext) (any, error)
- func CreateVolume(rc *plugin.RequestContext) (any, error)
- func DisconnectNetwork(rc *plugin.RequestContext) (any, error)
- func DockerErr(err error) error
- func ExecSchema() *plugin.Schema
- func ExecStream(rc *plugin.RequestContext, client plugin.ClientStream) error
- func ImageBuildSchema() *plugin.Schema
- func ImageOverview(rc *plugin.RequestContext) (any, error)
- func ImagePullSchema() *plugin.Schema
- func ImagePushSchema() *plugin.Schema
- func ImageTagSchema() *plugin.Schema
- func InspectContainer(rc *plugin.RequestContext) (any, error)
- func InspectImage(rc *plugin.RequestContext) (any, error)
- func InspectNetwork(rc *plugin.RequestContext) (any, error)
- func InspectVolume(rc *plugin.RequestContext) (any, error)
- func KillContainer(rc *plugin.RequestContext) (any, error)
- func KillContainerSchema() *plugin.Schema
- func ListCompose(rc *plugin.RequestContext) (any, error)
- func ListContainers(rc *plugin.RequestContext) (any, error)
- func ListImages(rc *plugin.RequestContext) (any, error)
- func ListNetworks(rc *plugin.RequestContext) (any, error)
- func ListVolumes(rc *plugin.RequestContext) (any, error)
- func LogsSchema() *plugin.Schema
- func LogsStream(rc *plugin.RequestContext, client plugin.ClientStream) error
- func MetricsLoop(rc *plugin.RequestContext, stream plugin.ClientStream, ...) error
- func NetworkConnectSchema() *plugin.Schema
- func NetworkCreateSchema() *plugin.Schema
- func NetworkDisconnectSchema() *plugin.Schema
- func NetworkOverview(rc *plugin.RequestContext) (any, error)
- func OverviewList(_ *plugin.RequestContext) (any, error)
- func OverviewMetrics(rc *plugin.RequestContext, stream plugin.ClientStream) error
- func OverviewMetricsConfig() plugin.MetricsConfig
- func OverviewRef() *plugin.ResourceRef
- func PageRows(rc *plugin.RequestContext, rows []Row) (plugin.Page[Row], error)
- func PauseContainer(rc *plugin.RequestContext) (any, error)
- func PruneContainers(rc *plugin.RequestContext) (any, error)
- func PruneImages(rc *plugin.RequestContext) (any, error)
- func PruneNetworks(rc *plugin.RequestContext) (any, error)
- func PruneVolumes(rc *plugin.RequestContext) (any, error)
- func PullImage(rc *plugin.RequestContext) (any, error)
- func PushImage(rc *plugin.RequestContext) (any, error)
- func RawOrValue(raw json.RawMessage, value any) (any, error)
- func RemoveContainer(rc *plugin.RequestContext) (any, error)
- func RemoveImage(rc *plugin.RequestContext) (any, error)
- func RemoveNetwork(rc *plugin.RequestContext) (any, error)
- func RemoveVolume(rc *plugin.RequestContext) (any, error)
- func RenameContainer(rc *plugin.RequestContext) (any, error)
- func RenameContainerSchema() *plugin.Schema
- func RestartContainer(rc *plugin.RequestContext) (any, error)
- func ShortID(id string) string
- func StartContainer(rc *plugin.RequestContext) (any, error)
- func StateSeverities() map[string]plugin.Severity
- func StopContainer(rc *plugin.RequestContext) (any, error)
- func TagImage(rc *plugin.RequestContext) (any, error)
- func TreeCompose(rc *plugin.RequestContext) (any, error)
- func TreeContainers(rc *plugin.RequestContext) (any, error)
- func TreeFromRows(rc *plugin.RequestContext, kind string, ...) (any, error)
- func TreeImages(rc *plugin.RequestContext) (any, error)
- func TreeNetworks(rc *plugin.RequestContext) (any, error)
- func TreeVolumes(rc *plugin.RequestContext) (any, error)
- func UnpauseContainer(rc *plugin.RequestContext) (any, error)
- func VolumeCreateSchema() *plugin.Schema
- func VolumeOverview(rc *plugin.RequestContext) (any, error)
- func WatchEvents(rc *plugin.RequestContext, client plugin.ClientStream) error
- func WhenState(states ...string) *plugin.Condition
- type ActionResult
- type BuildResult
- type ComposeResult
- type CreateContainerRequest
- type CreateContainerResult
- type PruneResult
- type Row
- type Session
- func (s *Session) Client() *dockerclient.Client
- func (s *Session) Close() error
- func (s *Session) HTTPClient() *http.Client
- func (s *Session) HealthCheck(ctx context.Context) error
- func (s *Session) OpenChannel(ctx context.Context, req plugin.ChannelRequest) (plugin.Channel, error)
- func (s *Session) ProxyURL(kind, id, port string) string
- func (s *Session) ServeHTTPProxy(w http.ResponseWriter, r *http.Request)
Constants ¶
const ComposeProjectLabel = "com.docker.compose.project"
ComposeProjectLabel groups containers/volumes into a Compose project.
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 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 ComposeServices ¶
func ComposeServices(rc *plugin.RequestContext) (any, error)
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 ContainerOverview ¶
func ContainerOverview(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 CreateContainer ¶
func CreateContainer(rc *plugin.RequestContext) (any, error)
func CreateContainerSchema ¶
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 ¶
DockerErr maps a moby client error to a platform sentinel so the response layer can pick the right status code.
func ExecSchema ¶
func ExecStream ¶
func ExecStream(rc *plugin.RequestContext, client plugin.ClientStream) error
func ImageBuildSchema ¶
func ImageOverview ¶
func ImageOverview(rc *plugin.RequestContext) (any, error)
func ImagePullSchema ¶
func ImagePushSchema ¶
func ImageTagSchema ¶
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 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 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 NetworkCreateSchema ¶
func NetworkDisconnectSchema ¶
func NetworkOverview ¶
func NetworkOverview(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.ResourceRef
OverviewRef opens the overview dashboard from a tree group.
func PauseContainer ¶
func PauseContainer(rc *plugin.RequestContext) (any, error)
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 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 RestartContainer ¶
func RestartContainer(rc *plugin.RequestContext) (any, error)
func StartContainer ¶
func StartContainer(rc *plugin.RequestContext) (any, error)
func StateSeverities ¶
StateSeverities colors a container "state" badge by value.
func StopContainer ¶
func StopContainer(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 VolumeCreateSchema ¶
func VolumeOverview ¶
func VolumeOverview(rc *plugin.RequestContext) (any, error)
func WatchEvents ¶
func WatchEvents(rc *plugin.RequestContext, client plugin.ClientStream) error
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 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 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 Row ¶
Row is one generic record returned by the shared handlers. It is an alias so plugin packages can build rows as plain maps and still feed PageRows/TreeFromRows.
func ContainerRows ¶
func NetworkRows ¶
func VolumeRows ¶
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 ¶
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) HTTPClient ¶
HTTPClient exposes the daemon-dialing HTTP client for Podman's libpod-only endpoints.
func (*Session) OpenChannel ¶
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...}`.