v3.5.0 8345e76

container.go RawHistoryFolder

1// Package domain contains pure business types without external dependencies.
2// These types are used throughout the application and have no tags or framework dependencies.
3package domain
4
5import "time"
6
7// Container represents a running container in the system.
8type Container struct {
9	ID           string
10	Image        string
11	ImageID      string // Docker image ID (sha256 digest) used to detect redundant deploys
12	Name         string
13	Status       string
14	ExitCode     int
15	Ports        []int
16	Labels       map[string]string
17	VolumeMounts []ContainerVolumeMount
18	Created      time.Time
19	// StartedAt is the start timestamp of the current execution. Zero
20	// when the container never started or the runtime reports none.
21	// Readiness scoping uses it so log markers from a previous
22	// execution of the same container ID cannot satisfy a probe.
23	StartedAt time.Time
24	// Env is the container's KEY=value environment as created. It may hold
25	// secret values: compare it in memory only, never persist or log it.
26	Env []string
27	// CapAdd is the container's configured capability add set as reported
28	// by the engine (names may carry a CAP_ prefix). Nil when the engine
29	// reports none. Reuse paths compare it with the current authorization.
30	CapAdd []string
31}
32
33// ContainerVolumeMount describes a mounted volume-like resource on a container.
34type ContainerVolumeMount struct {
35	Name        string
36	Type        string
37	Source      string
38	Destination string
39	ReadOnly    bool
40}
41
42// NetworkInfo represents network configuration and state.
43type NetworkInfo struct {
44	ID         string
45	Name       string
46	Driver     string
47	Containers []string
48	Labels     map[string]string
49}
50
51// NetworkConfig holds options for creating a container network.
52type NetworkConfig struct {
53	Driver   string
54	Internal bool
55	Labels   map[string]string
56}
57
58// Attachment represents an attached service container.
59type Attachment struct {
60	Name        string
61	Image       string
62	ContainerID string
63	Status      string
64	Network     string
65	Ports       []int
66}
67
68// RouteInfo combines route configuration with runtime state.
69type RouteInfo struct {
70	Domain          string
71	Image           string
72	ContainerID     string
73	ContainerStatus string
74	Network         string
75	Attachments     []Attachment
76}
77
78// ContainerPortPublish describes an explicit host port binding for a container port.
79type ContainerPortPublish struct {
80	HostIP        string
81	HostPort      int
82	ContainerPort int
83	Protocol      NetworkProtocol
84}
85
86// ContainerBackendPort identifies one protocol-specific container port
87// for grouped backend-bind inspection.
88type ContainerBackendPort struct {
89	ContainerPort int
90	Protocol      NetworkProtocol
91}
92
93// ContainerBackendBind is an observed protocol-specific host binding.
94type ContainerBackendBind struct {
95	ContainerPort int
96	HostPort      int
97	Protocol      NetworkProtocol
98}
99
100// ContainerBind is one ephemeral host bind mount for a container. Source is a
101// resolved host path produced by administrative policy: it is never persisted
102// and never logged by the runtime adapter. Destination is the container path.
103type ContainerBind struct {
104	Name        string
105	Source      string
106	Destination string
107	ReadOnly    bool
108}
109
110// ContainerConfig holds configuration for creating a container.
111type ContainerConfig struct {
112	Image           string
113	Name            string
114	Env             []string
115	Ports           []int
116	PortPublishes   []ContainerPortPublish
117	Labels          map[string]string
118	WorkingDir      string
119	Cmd             []string
120	Entrypoint      []string
121	AutoRemove      bool
122	RestartPolicy   string
123	Volumes         map[string]string // map[containerPath]volumeName
124	ReadOnlyVolumes map[string]string // containerPath -> volumeName (mounted read-only)
125	Binds           []ContainerBind   // ephemeral resolved host binds, keyed by destination
126	// CDIDevices holds explicit CDI device IDs resolved from administrative
127	// device policy at activation time. It is ephemeral like Binds: never
128	// persisted, never logged by the runtime adapter.
129	CDIDevices []string // ephemeral resolved CDI IDs, encoded as one native CDI DeviceRequest
130	// AddedCapabilities holds Linux capabilities resolved from
131	// administrative capability policy at activation time. It is ephemeral
132	// like CDIDevices: never persisted. The runtime adds them on top of the
133	// base capability set (default or CapAdd) and never alters CapDrop.
134	AddedCapabilities []string
135	NetworkMode       string   // Network to join
136	Hostname          string   // Container hostname for DNS
137	Aliases           []string // Additional network aliases
138	MemoryLimit       int64    // Memory limit in bytes (0 = no limit)
139	NanoCPUs          int64    // CPU quota in nanoseconds (1e9 = 1 core, 0 = no limit)
140	PidsLimit         int64    // Max number of PIDs (0 = no limit)
141	ReadOnlyRootFS    bool     // Mount container root filesystem read-only
142	User              string   // User to run as
143	CapDrop           []string // Linux capabilities to drop; nil uses runtime compat defaults
144	CapAdd            []string // Linux capabilities to add; nil uses runtime compat defaults
145}
146
147// ContainerStatus represents the current state of a container.
148type ContainerStatus string
149
150const (
151	ContainerStatusRunning ContainerStatus = "running"
152	ContainerStatusStopped ContainerStatus = "stopped"
153	ContainerStatusCreated ContainerStatus = "created"
154	ContainerStatusExited  ContainerStatus = "exited"
155	ContainerStatusPaused  ContainerStatus = "paused"
156	ContainerStatusUnknown ContainerStatus = "unknown"
157)
158
159const (
160	RestartPolicyAlways = "always"
161)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close