Documentation
¶
Overview ¶
Package container owns Docker container lifecycle, inspection, listing and stats, plus the HTTP surface that exposes them.
Index ¶
- func CollectImageIDs(containers []container.Summary) []string
- func FilterInternalContainers(containers []container.Summary, includeInternal bool) []container.Summary
- func RegisterContainers(api huma.API, containerSvc *ContainerService, ...)
- type CommitContainerInput
- type CommitContainerOutput
- type ContainerActionInput
- type ContainerActionOutput
- type ContainerHandler
- func (h *ContainerHandler) CommitContainer(ctx context.Context, input *CommitContainerInput) (*CommitContainerOutput, error)
- func (h *ContainerHandler) CreateContainer(ctx context.Context, input *CreateContainerInput) (*CreateContainerOutput, error)
- func (h *ContainerHandler) DeleteContainer(ctx context.Context, input *DeleteContainerInput) (*DeleteContainerOutput, error)
- func (h *ContainerHandler) GetContainer(ctx context.Context, input *GetContainerInput) (*GetContainerOutput, error)
- func (h *ContainerHandler) GetContainerStatusCounts(ctx context.Context, input *GetContainerStatusCountsInput) (*GetContainerStatusCountsOutput, error)
- func (h *ContainerHandler) KillContainer(ctx context.Context, input *KillContainerInput) (*ContainerActionOutput, error)
- func (h *ContainerHandler) ListContainers(ctx context.Context, input *ListContainersInput) (*ListContainersOutput, error)
- func (h *ContainerHandler) PauseContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
- func (h *ContainerHandler) RedeployContainer(ctx context.Context, input *ContainerActionInput) (*GetContainerOutput, error)
- func (h *ContainerHandler) RestartContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
- func (h *ContainerHandler) SetAutoUpdate(ctx context.Context, input *SetAutoUpdateInput) (*SetAutoUpdateOutput, error)
- func (h *ContainerHandler) StartContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
- func (h *ContainerHandler) StopContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
- func (h *ContainerHandler) UnpauseContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
- type ContainerListResult
- type ContainerPaginatedResponse
- type ContainerService
- 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(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) (string, error)
- func (s *ContainerService) DeleteContainer(ctx context.Context, containerID string, force bool, removeVolumes bool, ...) 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) GetContainerNameByID(ctx context.Context, id string) (string, error)
- func (s *ContainerService) GetContainerNameByReference(ctx context.Context, ref string) (string, error)
- func (s *ContainerService) KillContainer(ctx context.Context, containerID, signal string, user common.User) 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 common.User) error
- func (s *ContainerService) RedeployContainer(ctx context.Context, containerID string, user common.User) (string, error)
- func (s *ContainerService) RestartContainer(ctx context.Context, containerID string, user common.User) error
- func (s *ContainerService) StartContainer(ctx context.Context, containerID string, user common.User) error
- func (s *ContainerService) StopContainer(ctx context.Context, containerID string, user common.User) 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 common.User) error
- type CreateContainerInput
- type CreateContainerOutput
- type DeleteContainerInput
- type DeleteContainerOutput
- type Dependencies
- type ExecSession
- type GetContainerInput
- type GetContainerOutput
- type GetContainerStatusCountsInput
- type GetContainerStatusCountsOutput
- type KillContainerInput
- type ListContainersInput
- type ListContainersOutput
- type Module
- type SetAutoUpdateInput
- type SetAutoUpdateOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectImageIDs ¶
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 containertypes.CommitRequest
}
type CommitContainerOutput ¶
type CommitContainerOutput struct {
Body base.ApiResponse[containertypes.CommitResult]
}
type ContainerActionInput ¶
type ContainerActionOutput ¶
type ContainerActionOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type ContainerHandler ¶
type ContainerHandler struct {
// contains filtered or unexported fields
}
func (*ContainerHandler) CommitContainer ¶
func (h *ContainerHandler) CommitContainer(ctx context.Context, input *CommitContainerInput) (*CommitContainerOutput, error)
func (*ContainerHandler) CreateContainer ¶
func (h *ContainerHandler) CreateContainer(ctx context.Context, input *CreateContainerInput) (*CreateContainerOutput, error)
func (*ContainerHandler) DeleteContainer ¶
func (h *ContainerHandler) DeleteContainer(ctx context.Context, input *DeleteContainerInput) (*DeleteContainerOutput, error)
func (*ContainerHandler) GetContainer ¶
func (h *ContainerHandler) GetContainer(ctx context.Context, input *GetContainerInput) (*GetContainerOutput, error)
func (*ContainerHandler) GetContainerStatusCounts ¶
func (h *ContainerHandler) GetContainerStatusCounts(ctx context.Context, input *GetContainerStatusCountsInput) (*GetContainerStatusCountsOutput, error)
func (*ContainerHandler) KillContainer ¶
func (h *ContainerHandler) KillContainer(ctx context.Context, input *KillContainerInput) (*ContainerActionOutput, 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) (*ContainerActionOutput, error)
func (*ContainerHandler) RedeployContainer ¶
func (h *ContainerHandler) RedeployContainer(ctx context.Context, input *ContainerActionInput) (*GetContainerOutput, error)
func (*ContainerHandler) RestartContainer ¶
func (h *ContainerHandler) RestartContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
func (*ContainerHandler) SetAutoUpdate ¶
func (h *ContainerHandler) SetAutoUpdate(ctx context.Context, input *SetAutoUpdateInput) (*SetAutoUpdateOutput, error)
func (*ContainerHandler) StartContainer ¶
func (h *ContainerHandler) StartContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
func (*ContainerHandler) StopContainer ¶
func (h *ContainerHandler) StopContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, error)
func (*ContainerHandler) UnpauseContainer ¶
func (h *ContainerHandler) UnpauseContainer(ctx context.Context, input *ContainerActionInput) (*ContainerActionOutput, 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 []containertypes.Summary `json:"data"`
Groups []containertypes.SummaryGroup `json:"groups,omitempty"`
Counts containertypes.StatusCounts `json:"counts"`
Pagination base.PaginationResponse `json:"pagination"`
}
ContainerPaginatedResponse is the paginated list response for containers.
type ContainerService ¶
type ContainerService struct {
// contains filtered or unexported fields
}
func NewContainerService ¶
func NewContainerService(ctx context.Context, eventService *event.EventService, dockerService *docker.DockerClientService, imageService *image.ImageService, settingsService *settings.SettingsService, projectService *project.ProjectService) *ContainerService
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(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 common.User) (*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 common.User, credentials []containerregistry.Credential) (*container.InspectResponse, error)
func (*ContainerService) CreateExec ¶
func (s *ContainerService) CreateExec(ctx context.Context, containerID string, cmd []string) (string, error)
CreateExec creates an exec instance in the container
func (*ContainerService) DeleteContainer ¶
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) 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) KillContainer ¶
func (s *ContainerService) KillContainer(ctx context.Context, containerID, signal string, user common.User) 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, groupBy string, ) (ContainerListResult, error)
func (*ContainerService) PauseContainer ¶
func (s *ContainerService) PauseContainer(ctx context.Context, containerID string, user common.User) error
PauseContainer suspends all processes in the container.
func (*ContainerService) RedeployContainer ¶
func (*ContainerService) RestartContainer ¶
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 common.User) error
UnpauseContainer resumes a previously paused container.
type CreateContainerInput ¶
type CreateContainerInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body containertypes.Create
}
type CreateContainerOutput ¶
type CreateContainerOutput struct {
Body base.ApiResponse[containertypes.Created]
}
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 DeleteContainerOutput ¶
type DeleteContainerOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type Dependencies ¶
type Dependencies struct {
Event *event.EventService
Docker *docker.DockerClientService
Image *image.ImageService
Settings *settings.SettingsService
Project *project.ProjectService
Activity *activity.ActivityService
}
Dependencies are the collaborators the container domain needs.
type ExecSession ¶
type ExecSession struct {
// contains filtered or unexported fields
}
ExecSession manages the lifecycle of a Docker exec session.
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 GetContainerInput ¶
type GetContainerOutput ¶
type GetContainerOutput struct {
Body base.ApiResponse[containertypes.Details]
}
type GetContainerStatusCountsOutput ¶
type GetContainerStatusCountsOutput struct {
Body base.ApiResponse[containertypes.StatusCounts]
}
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"`
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)"`
}
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(ctx context.Context, deps Dependencies) *Module
New builds the container domain from its dependencies.
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 that use it directly.
type SetAutoUpdateInput ¶
type SetAutoUpdateInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ContainerID string `path:"containerId" doc:"Container ID"`
Body struct {
Enabled bool `json:"enabled" doc:"Whether auto-update is enabled for this container"`
}
}
SetAutoUpdateInput is the request input for toggling container auto-update.
type SetAutoUpdateOutput ¶
type SetAutoUpdateOutput struct {
Body base.ApiResponse[base.MessageResponse]
}