container

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: BSD-3-Clause Imports: 49 Imported by: 0

Documentation

Overview

Package container owns Docker container lifecycle, inspection, listing and stats, plus the HTTP surface that exposes them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectImageIDs

func CollectImageIDs(containers []container.Summary) []string

func FilterInternalContainers

func FilterInternalContainers(containers []container.Summary, includeInternal bool) []container.Summary

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 ContainerActionInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	ContainerID   string `path:"containerId" doc:"Container ID"`
}

type ContainerActionOutput

type ContainerActionOutput struct {
	Body base.ApiResponse[base.MessageResponse]
}

type ContainerHandler

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

func (*ContainerHandler) CommitContainer

func (*ContainerHandler) CreateContainer

func (*ContainerHandler) DeleteContainer

func (*ContainerHandler) GetContainer

func (h *ContainerHandler) GetContainer(ctx context.Context, input *GetContainerInput) (*GetContainerOutput, error)

func (*ContainerHandler) GetContainerStatusCounts

func (*ContainerHandler) KillContainer

func (*ContainerHandler) ListContainers

func (*ContainerHandler) PauseContainer

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 (*ContainerHandler) StopContainer

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 (s *ContainerService) DeleteContainer(ctx context.Context, containerID string, force bool, removeVolumes bool, user common.User) error

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

func (s *ContainerService) GetContainerNameByID(ctx context.Context, id string) (string, error)

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 (s *ContainerService) RedeployContainer(ctx context.Context, containerID string, user common.User) (string, error)

func (*ContainerService) RestartContainer

func (s *ContainerService) RestartContainer(ctx context.Context, containerID string, user common.User) error

func (*ContainerService) StartContainer

func (s *ContainerService) StartContainer(ctx context.Context, containerID string, user common.User) error

func (*ContainerService) StopContainer

func (s *ContainerService) StopContainer(ctx context.Context, containerID string, user common.User) error

func (*ContainerService) StreamLogs

func (s *ContainerService) StreamLogs(ctx context.Context, containerID string, logsChan chan<- string, follow bool, tail, since string, timestamps bool) error

func (*ContainerService) StreamStats

func (s *ContainerService) StreamStats(ctx context.Context, containerID string, statsChan chan<- any) error

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 GetContainerInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	ContainerID   string `path:"containerId" doc:"Container ID"`
}

type GetContainerOutput

type GetContainerOutput struct {
	Body base.ApiResponse[containertypes.Details]
}

type GetContainerStatusCountsInput

type GetContainerStatusCountsInput struct {
	EnvironmentID   string `path:"id" doc:"Environment ID"`
	IncludeInternal bool   `query:"includeInternal" default:"false" doc:"Include internal containers"`
}

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]
}

Jump to

Keyboard shortcuts

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