Documentation
¶
Overview ¶
Package container owns Docker container lifecycle, inspection, listing and stats, plus the HTTP surface that exposes them.
Index ¶
- Constants
- func FilterExcludedContainers(containers []container.Summary, includeInternal, includeHidden bool) []container.Summary
- func RegisterContainers(api huma.API, containerSvc *ContainerService, ...)
- type CommitContainerInput
- type ContainerActionInput
- type ContainerHandler
- func (h *ContainerHandler) CommitContainer(ctx context.Context, input *CommitContainerInput) (*handlerutil.Out[container.CommitResult], error)
- func (h *ContainerHandler) CreateContainer(ctx context.Context, input *CreateContainerInput) (*handlerutil.Out[container.Created], error)
- func (h *ContainerHandler) DeleteContainer(ctx context.Context, input *DeleteContainerInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ContainerHandler) DownloadContainerLogs(ctx context.Context, input *GetContainerInput) (*huma.StreamResponse, error)
- func (h *ContainerHandler) EditContainer(ctx context.Context, input *EditContainerInput) (*handlerutil.Out[container.Details], error)
- func (h *ContainerHandler) GenerateCompose(ctx context.Context, input *GenerateComposeInput) (*handlerutil.Out[container.GenerateComposeResponse], error)
- func (h *ContainerHandler) GetContainer(ctx context.Context, input *GetContainerInput) (*handlerutil.Out[container.Details], error)
- func (h *ContainerHandler) GetContainerEditConfig(ctx context.Context, input *GetContainerEditConfigInput) (*handlerutil.Out[container.EditConfig], error)
- func (h *ContainerHandler) GetContainerProcesses(ctx context.Context, input *GetContainerInput) (*handlerutil.Out[container.Processes], error)
- func (h *ContainerHandler) GetContainerStatusCounts(ctx context.Context, input *GetContainerStatusCountsInput) (*handlerutil.Out[container.StatusCounts], error)
- func (h *ContainerHandler) KillContainer(ctx context.Context, input *KillContainerInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ContainerHandler) ListContainers(ctx context.Context, input *ListContainersInput) (*ListContainersOutput, error)
- func (h *ContainerHandler) PauseContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ContainerHandler) RedeployContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[container.Details], error)
- func (h *ContainerHandler) RestartContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ContainerHandler) SetAutoUpdate(ctx context.Context, input *SetAutoUpdateInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ContainerHandler) StartContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ContainerHandler) StopContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ContainerHandler) UnpauseContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
- type ContainerListResult
- type ContainerPaginatedResponse
- type ContainerService
- func (s *ContainerService) AggregateContainers(ctx context.Context, params pagination.QueryParams, groupBy string) (ContainerPaginatedResponse, error)
- func (s *ContainerService) ApplySummaryIcons(ctx context.Context, summaries []containertypes.Summary, ...)
- func (s *ContainerService) AttachExec(ctx context.Context, containerID, execID string) (*ExecSession, error)
- func (s *ContainerService) BuildSummaries(ctx context.Context, containers []container.Summary, ...) []containertypes.Summary
- func (s *ContainerService) CalculateStatusCounts(items []containertypes.Summary) containertypes.StatusCounts
- func (s *ContainerService) CommitContainer(ctx context.Context, containerID string, req containertypes.CommitRequest, ...) (*containertypes.CommitResult, error)
- func (s *ContainerService) CreateContainer(ctx context.Context, config *container.Config, ...) (*container.InspectResponse, error)
- func (s *ContainerService) CreateExec(ctx context.Context, containerID string, cmd []string, cols, rows uint) (string, error)
- func (s *ContainerService) DeleteContainer(ctx context.Context, containerID string, force, removeVolumes bool, ...) error
- func (s *ContainerService) DownloadLogs(ctx context.Context, containerID string) (io.ReadCloser, string, error)
- func (s *ContainerService) EditContainer(ctx context.Context, containerID string, req containertypes.Edit, ...) (string, error)
- func (s *ContainerService) GetContainerByID(ctx context.Context, id string) (*container.InspectResponse, error)
- func (s *ContainerService) GetContainerByReference(ctx context.Context, ref string) (*container.InspectResponse, error)
- func (s *ContainerService) GetContainerDetails(ctx context.Context, id string) (containertypes.Details, error)
- func (s *ContainerService) GetContainerEditConfig(ctx context.Context, containerID string) (containertypes.EditConfig, error)
- func (s *ContainerService) GetContainerNameByID(ctx context.Context, id string) (string, error)
- func (s *ContainerService) GetContainerNameByReference(ctx context.Context, ref string) (string, error)
- func (s *ContainerService) GetContainerProcesses(ctx context.Context, containerID string) (containertypes.Processes, error)
- func (s *ContainerService) KillContainer(ctx context.Context, containerID, signal string, user usertypes.Actor) error
- func (s *ContainerService) ListContainersPaginated(ctx context.Context, params pagination.QueryParams, includeAll bool, ...) (ContainerListResult, error)
- func (s *ContainerService) PauseContainer(ctx context.Context, containerID string, user usertypes.Actor) error
- func (s *ContainerService) RecoverInterruptedRedeploys(ctx context.Context) error
- func (s *ContainerService) RedeployContainer(ctx context.Context, containerID string, user usertypes.Actor) (string, error)
- func (s *ContainerService) ResizeExec(ctx context.Context, execID string, cols, rows uint) error
- func (s *ContainerService) RestartContainer(ctx context.Context, containerID string, user usertypes.Actor) error
- func (s *ContainerService) SampleResources(ctx context.Context, ids []string, maxAge time.Duration) (map[string]*containertypes.ResourceSample, error)
- func (s *ContainerService) StartContainer(ctx context.Context, containerID string, user usertypes.Actor) error
- func (s *ContainerService) StopContainer(ctx context.Context, containerID string, user usertypes.Actor) error
- func (s *ContainerService) StreamLogs(ctx context.Context, containerID string, logsChan chan<- string, follow bool, ...) error
- func (s *ContainerService) StreamStats(ctx context.Context, containerID string, statsChan chan<- any) error
- func (s *ContainerService) UnpauseContainer(ctx context.Context, containerID string, user usertypes.Actor) error
- type CreateContainerInput
- type DeleteContainerInput
- type EditContainerInput
- type ExecSession
- type GenerateComposeInput
- type GetContainerEditConfigInput
- type GetContainerInput
- type GetContainerStatusCountsInput
- type KillContainerInput
- type ListContainersInput
- type ListContainersOutput
- type Module
- type RedeployJournal
- type SetAutoUpdateInput
Constants ¶
const ResourceSampleLimit = 500
ResourceSampleLimit caps how many requested containers one SampleResources call reads.
Variables ¶
This section is empty.
Functions ¶
func FilterExcludedContainers ¶ added in v2.11.0
func FilterExcludedContainers(containers []container.Summary, includeInternal, includeHidden bool) []container.Summary
FilterExcludedContainers removes internal and hidden containers unless their corresponding inclusion flags are enabled.
func RegisterContainers ¶
func RegisterContainers( api huma.API, containerSvc *ContainerService, dockerSvc *docker.DockerClientService, settingsSvc *settings.SettingsService, activitySvc *activity.ActivityService, appCtx handlerutil.ActivityAppContext, )
Types ¶
type CommitContainerInput ¶
type CommitContainerInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ContainerID string `path:"containerId" doc:"Container ID"`
Body container.CommitRequest
}
type ContainerActionInput ¶
type ContainerHandler ¶
type ContainerHandler struct {
// contains filtered or unexported fields
}
func (*ContainerHandler) CommitContainer ¶
func (h *ContainerHandler) CommitContainer(ctx context.Context, input *CommitContainerInput) (*handlerutil.Out[container.CommitResult], error)
func (*ContainerHandler) CreateContainer ¶
func (h *ContainerHandler) CreateContainer(ctx context.Context, input *CreateContainerInput) (*handlerutil.Out[container.Created], error)
func (*ContainerHandler) DeleteContainer ¶
func (h *ContainerHandler) DeleteContainer(ctx context.Context, input *DeleteContainerInput) (*handlerutil.Out[base.MessageResponse], error)
func (*ContainerHandler) DownloadContainerLogs ¶ added in v2.12.0
func (h *ContainerHandler) DownloadContainerLogs(ctx context.Context, input *GetContainerInput) (*huma.StreamResponse, error)
func (*ContainerHandler) EditContainer ¶ added in v2.9.0
func (h *ContainerHandler) EditContainer(ctx context.Context, input *EditContainerInput) (*handlerutil.Out[container.Details], error)
func (*ContainerHandler) GenerateCompose ¶ added in v2.10.0
func (h *ContainerHandler) GenerateCompose(ctx context.Context, input *GenerateComposeInput) (*handlerutil.Out[container.GenerateComposeResponse], error)
func (*ContainerHandler) GetContainer ¶
func (h *ContainerHandler) GetContainer(ctx context.Context, input *GetContainerInput) (*handlerutil.Out[container.Details], error)
func (*ContainerHandler) GetContainerEditConfig ¶ added in v2.9.0
func (h *ContainerHandler) GetContainerEditConfig(ctx context.Context, input *GetContainerEditConfigInput) (*handlerutil.Out[container.EditConfig], error)
func (*ContainerHandler) GetContainerProcesses ¶ added in v2.14.0
func (h *ContainerHandler) GetContainerProcesses(ctx context.Context, input *GetContainerInput) (*handlerutil.Out[container.Processes], error)
func (*ContainerHandler) GetContainerStatusCounts ¶
func (h *ContainerHandler) GetContainerStatusCounts(ctx context.Context, input *GetContainerStatusCountsInput) (*handlerutil.Out[container.StatusCounts], error)
func (*ContainerHandler) KillContainer ¶
func (h *ContainerHandler) KillContainer(ctx context.Context, input *KillContainerInput) (*handlerutil.Out[base.MessageResponse], error)
func (*ContainerHandler) ListContainers ¶
func (h *ContainerHandler) ListContainers(ctx context.Context, input *ListContainersInput) (*ListContainersOutput, error)
func (*ContainerHandler) PauseContainer ¶
func (h *ContainerHandler) PauseContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
func (*ContainerHandler) RedeployContainer ¶
func (h *ContainerHandler) RedeployContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[container.Details], error)
func (*ContainerHandler) RestartContainer ¶
func (h *ContainerHandler) RestartContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
func (*ContainerHandler) SetAutoUpdate ¶
func (h *ContainerHandler) SetAutoUpdate(ctx context.Context, input *SetAutoUpdateInput) (*handlerutil.Out[base.MessageResponse], error)
func (*ContainerHandler) StartContainer ¶
func (h *ContainerHandler) StartContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
func (*ContainerHandler) StopContainer ¶
func (h *ContainerHandler) StopContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
func (*ContainerHandler) UnpauseContainer ¶
func (h *ContainerHandler) UnpauseContainer(ctx context.Context, input *ContainerActionInput) (*handlerutil.Out[base.MessageResponse], error)
type ContainerListResult ¶
type ContainerListResult struct {
Items []containertypes.Summary
Groups []containertypes.SummaryGroup
Pagination pagination.Response
Counts containertypes.StatusCounts
}
type ContainerPaginatedResponse ¶
type ContainerPaginatedResponse struct {
Success bool `json:"success"`
Data []container.Summary `json:"data"`
Groups []container.SummaryGroup `json:"groups,omitempty"`
Counts container.StatusCounts `json:"counts"`
Pagination base.PaginationResponse `json:"pagination"`
ResourceSortSupported bool `json:"resourceSortSupported"`
FailedEnvironments []base.EnvironmentFailure `json:"failedEnvironments,omitempty" doc:"Environments whose results are missing from a multi-environment response"`
}
ContainerPaginatedResponse is the paginated list response for containers.
type ContainerService ¶
type ContainerService struct {
// contains filtered or unexported fields
}
func NewContainerService ¶
func NewContainerService( eventService *event.EventService, dockerService *dockerInternal.DockerClientService, imageService *image.ImageService, settingsService *settings.SettingsService, projectService *project.ProjectService, kvService *kv.KVService, podmanService *podman.Service, ) *ContainerService
func (*ContainerService) AggregateContainers ¶ added in v2.16.1
func (s *ContainerService) AggregateContainers(ctx context.Context, params pagination.QueryParams, groupBy string) (ContainerPaginatedResponse, error)
func (*ContainerService) ApplySummaryIcons ¶
func (s *ContainerService) ApplySummaryIcons(ctx context.Context, summaries []containertypes.Summary, metadataByProject map[string]projects.ArcaneComposeMetadata)
ApplySummaryIcons resolves icons for a page of summaries. Icon resolution is deferred until after pagination so the cost is bounded by page size rather than the full container list.
func (*ContainerService) AttachExec ¶
func (s *ContainerService) AttachExec(ctx context.Context, containerID, execID string) (*ExecSession, error)
AttachExec attaches to an exec instance and returns an ExecSession for lifecycle management.
func (*ContainerService) BuildSummaries ¶
func (s *ContainerService) BuildSummaries( ctx context.Context, containers []container.Summary, updateInfoMap map[string]*imagetypes.UpdateInfo, currentContainerID string, currentContainerErr error, ) []containertypes.Summary
func (*ContainerService) CalculateStatusCounts ¶
func (s *ContainerService) CalculateStatusCounts(items []containertypes.Summary) containertypes.StatusCounts
func (*ContainerService) CommitContainer ¶
func (s *ContainerService) CommitContainer(ctx context.Context, containerID string, req containertypes.CommitRequest, user usertypes.Actor) (*containertypes.CommitResult, error)
CommitContainer creates an image from a container's current filesystem.
func (*ContainerService) CreateContainer ¶
func (s *ContainerService) CreateContainer( ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string, user usertypes.Actor, credentials []containerregistry.Credential, ) ( *container.InspectResponse, error, )
func (*ContainerService) CreateExec ¶
func (s *ContainerService) CreateExec(ctx context.Context, containerID string, cmd []string, cols, rows uint) (string, error)
CreateExec creates an exec instance in the container
func (*ContainerService) DeleteContainer ¶
func (*ContainerService) DownloadLogs ¶ added in v2.12.0
func (s *ContainerService) DownloadLogs(ctx context.Context, containerID string) (io.ReadCloser, string, error)
DownloadLogs returns every log line Docker retains for the container as a single plain-text stream plus the attachment filename. Callers must Close it.
func (*ContainerService) EditContainer ¶ added in v2.9.0
func (s *ContainerService) EditContainer(ctx context.Context, containerID string, req containertypes.Edit, user usertypes.Actor) (string, error)
EditContainer applies a user-supplied config diff onto the container's inspected config and recreates it. Sections not owned by the edit form are preserved from the existing container.
func (*ContainerService) GetContainerByID ¶
func (s *ContainerService) GetContainerByID(ctx context.Context, id string) (*container.InspectResponse, error)
func (*ContainerService) GetContainerByReference ¶
func (s *ContainerService) GetContainerByReference(ctx context.Context, ref string) (*container.InspectResponse, error)
func (*ContainerService) GetContainerDetails ¶
func (s *ContainerService) GetContainerDetails(ctx context.Context, id string) (containertypes.Details, error)
func (*ContainerService) GetContainerEditConfig ¶ added in v2.9.0
func (s *ContainerService) GetContainerEditConfig(ctx context.Context, containerID string) (containertypes.EditConfig, error)
GetContainerEditConfig returns the purpose-built DTO backing the container edit form.
func (*ContainerService) GetContainerNameByID ¶
GetContainerNameByID resolves a container's clean name from its Docker ID.
func (*ContainerService) GetContainerNameByReference ¶
func (s *ContainerService) GetContainerNameByReference(ctx context.Context, ref string) (string, error)
GetContainerNameByReference resolves a container's clean name from a Docker ID or name.
func (*ContainerService) GetContainerProcesses ¶ added in v2.14.0
func (s *ContainerService) GetContainerProcesses(ctx context.Context, containerID string) (containertypes.Processes, error)
GetContainerProcesses returns Docker's `top` snapshot for a container.
func (*ContainerService) KillContainer ¶
func (s *ContainerService) KillContainer(ctx context.Context, containerID, signal string, user usertypes.Actor) error
KillContainer sends a signal to the container's main process (default SIGKILL when signal is empty) without removing the container.
func (*ContainerService) ListContainersPaginated ¶
func (s *ContainerService) ListContainersPaginated( ctx context.Context, params pagination.QueryParams, includeAll bool, includeInternal bool, includeHidden bool, groupBy string, ) (ContainerListResult, error)
func (*ContainerService) PauseContainer ¶
func (s *ContainerService) PauseContainer(ctx context.Context, containerID string, user usertypes.Actor) error
PauseContainer suspends all processes in the container.
func (*ContainerService) RecoverInterruptedRedeploys ¶ added in v2.17.0
func (s *ContainerService) RecoverInterruptedRedeploys(ctx context.Context) error
RecoverInterruptedRedeploys resolves journaled redeploy backups a restart left behind: a backup whose replacement is running is removed, and a backup with no replacement gets its original name back but stays stopped.
func (*ContainerService) RedeployContainer ¶
func (*ContainerService) ResizeExec ¶ added in v2.17.0
func (*ContainerService) RestartContainer ¶
func (*ContainerService) SampleResources ¶ added in v2.16.1
func (s *ContainerService) SampleResources(ctx context.Context, ids []string, maxAge time.Duration) (map[string]*containertypes.ResourceSample, error)
SampleResources samples the running containers among the first ResourceSampleLimit ids, refetching samples older than maxAge. Blank, stopped and unknown IDs are omitted.
func (*ContainerService) StartContainer ¶
func (*ContainerService) StopContainer ¶
func (*ContainerService) StreamLogs ¶
func (*ContainerService) StreamStats ¶
func (*ContainerService) UnpauseContainer ¶
func (s *ContainerService) UnpauseContainer(ctx context.Context, containerID string, user usertypes.Actor) error
UnpauseContainer resumes a previously paused container.
type CreateContainerInput ¶
type DeleteContainerInput ¶
type DeleteContainerInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ContainerID string `path:"containerId" doc:"Container ID"`
Force bool `query:"force" default:"false" doc:"Force delete running container"`
RemoveVolumes bool `query:"volumes" default:"false" doc:"Remove associated volumes"`
}
type EditContainerInput ¶ added in v2.9.0
type ExecSession ¶
type ExecSession struct {
// contains filtered or unexported fields
}
func (*ExecSession) Close ¶
func (e *ExecSession) Close(ctx context.Context) error
Close terminates the exec session and kills the process if still running.
func (*ExecSession) Stdin ¶
func (e *ExecSession) Stdin() io.WriteCloser
func (*ExecSession) Stdout ¶
func (e *ExecSession) Stdout() io.Reader
type GenerateComposeInput ¶ added in v2.10.0
type GenerateComposeInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body container.GenerateComposeRequest
}
type GetContainerEditConfigInput ¶ added in v2.9.0
type GetContainerInput ¶
type KillContainerInput ¶
type KillContainerInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ContainerID string `path:"containerId" doc:"Container ID"`
Signal string `query:"signal" doc:"Signal to send (for example SIGTERM, SIGKILL). Defaults to SIGKILL."`
}
KillContainerInput carries the optional signal for a container kill.
type ListContainersInput ¶
type ListContainersInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Search string `query:"search" doc:"Search query"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction"`
Start int `query:"start" default:"0" doc:"Start index"`
Limit int `query:"limit" default:"20" doc:"Limit"`
GroupBy string `query:"groupBy" doc:"Optional grouping mode (for example: project)"`
IncludeInternal bool `query:"includeInternal" default:"false" doc:"Include internal containers"`
IncludeHidden bool `query:"includeHidden" default:"false" doc:"Include hidden containers"`
Updates string `query:"updates" doc:"Filter by update status (has_update, up_to_date, error, unknown)"`
Standalone string `query:"standalone" doc:"Filter standalone containers only (true/false)"`
Label string `query:"label" doc:"Filter by label key or key=value"`
}
type ListContainersOutput ¶
type ListContainersOutput struct {
Body ContainerPaginatedResponse
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module wires the container domain and mounts its routes.
func New ¶
func New(service *ContainerService, dockerService *docker.DockerClientService, settingsService *settings.SettingsService, activityService *activity.ActivityService) *Module
New wires container routes around an existing service and registers per-container resource metrics once.
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext)
RegisterRoutes mounts the container endpoints. A nil module still registers, so OpenAPI spec generation can discover the routes without a service graph.
func (*Module) Service ¶
func (m *Module) Service() *ContainerService
Service exposes the container service to collaborators.
type RedeployJournal ¶ added in v2.17.0
type RedeployJournal struct {
OriginalID string `json:"originalId"`
OriginalName string `json:"originalName"`
BackupName string `json:"backupName"`
NewName string `json:"newName"`
StartedAt time.Time `json:"startedAt"`
}
RedeployJournal records a container Arcane renamed to a backup name, so recovery only touches its own backups.
type SetAutoUpdateInput ¶
type SetAutoUpdateInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ContainerID string `path:"containerId" doc:"Container ID"`
Body container.SetAutoUpdateRequest
}
SetAutoUpdateInput is the request input for toggling container auto-update.