containers

package
v0.0.0-...-1fc562e Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package containers implements the Docker Engine API surface for container lifecycle management, translating each endpoint into Kubernetes Deployment operations via the adapter layer.

Endpoints handled:

GET    /containers/json           → docker ps / docker ps -a
POST   /containers/create         → docker run (create phase)
POST   /containers/{id}/start     → docker start
POST   /containers/{id}/stop      → docker stop
DELETE /containers/{id}           → docker rm
GET    /containers/{id}/json      → docker inspect
GET    /containers/{id}/logs      → docker logs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler holds dependencies for all container API endpoints.

func NewHandler

func NewHandler(a *adapter.KubernetesDockerAdapter) *Handler

NewHandler creates a Handler.

func (*Handler) Attach

func (h *Handler) Attach(w http.ResponseWriter, r *http.Request)

Attach handles POST /containers/{id}/attach. With stdin it attaches to the container's process. Without, it follows the container's log: the Docker CLI attaches before starting a container, and a process attach would miss what the container prints before the attach connects.

func (*Handler) Create

func (h *Handler) Create(w http.ResponseWriter, r *http.Request)

Create handles POST /containers/create (docker run — create phase).

func (*Handler) DispatchAction

func (h *Handler) DispatchAction(w http.ResponseWriter, r *http.Request)

DispatchAction handles POST /containers/{id}/start, /stop, /restart, /wait.

func (*Handler) DispatchGet

func (h *Handler) DispatchGet(w http.ResponseWriter, r *http.Request)

DispatchGet handles GET /containers/{id}/json and GET /containers/{id}/logs.

func (*Handler) Inspect

func (h *Handler) Inspect(w http.ResponseWriter, r *http.Request)

Inspect handles GET /containers/{id}/json.

func (*Handler) List

func (h *Handler) List(w http.ResponseWriter, r *http.Request)

List handles GET /containers/json (docker ps / docker ps -a).

func (*Handler) Logs

func (h *Handler) Logs(w http.ResponseWriter, r *http.Request)

Logs handles GET /containers/{id}/logs.

func (*Handler) PutArchive

func (h *Handler) PutArchive(w http.ResponseWriter, r *http.Request)

PutArchive handles PUT /containers/{id}/archive: it writes the files of a tar archive into the container under the directory named by path, as `docker cp` and compose's secrets and configs do.

func (*Handler) Remove

func (h *Handler) Remove(w http.ResponseWriter, r *http.Request)

Remove handles DELETE /containers/{id}.

func (*Handler) Rename

func (h *Handler) Rename(w http.ResponseWriter, r *http.Request)

Rename handles POST /containers/{id}/rename.

func (*Handler) Resize

func (h *Handler) Resize(w http.ResponseWriter, r *http.Request)

Resize handles POST /containers/{id}/resize: it resizes the TTY of the container's attach sessions, if any.

func (*Handler) Restart

func (h *Handler) Restart(w http.ResponseWriter, r *http.Request)

Restart handles POST /containers/{id}/restart.

func (*Handler) Start

func (h *Handler) Start(w http.ResponseWriter, r *http.Request)

Start handles POST /containers/{id}/start.

func (*Handler) Stats

func (h *Handler) Stats(w http.ResponseWriter, r *http.Request)

Stats handles GET /containers/{id}/stats: one sample, or one a second while stream is set.

func (*Handler) Stop

func (h *Handler) Stop(w http.ResponseWriter, r *http.Request)

Stop handles POST /containers/{id}/stop.

func (*Handler) Wait

func (h *Handler) Wait(w http.ResponseWriter, r *http.Request)

Wait handles POST /containers/{id}/wait: it answers when the container stops running (condition not-running, the default), next exits (next-exit) or is removed (removed), with its exit code.

Jump to

Keyboard shortcuts

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