File: info.go

package info (click to toggle)
docker.io 28.5.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 69,048 kB
  • sloc: sh: 5,867; makefile: 863; ansic: 184; python: 162; asm: 159
file content (174 lines) | stat: -rw-r--r-- 6,196 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
package system

import (
	"github.com/docker/docker/api/types/container"
	"github.com/docker/docker/api/types/registry"
	"github.com/docker/docker/api/types/swarm"
)

// Info contains response of Engine API:
// GET "/info"
type Info struct {
	ID                string
	Containers        int
	ContainersRunning int
	ContainersPaused  int
	ContainersStopped int
	Images            int
	Driver            string
	DriverStatus      [][2]string
	SystemStatus      [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API
	Plugins           PluginsInfo
	MemoryLimit       bool
	SwapLimit         bool
	KernelMemory      bool `json:",omitempty"` // Deprecated: kernel 5.4 deprecated kmem.limit_in_bytes
	// KernelMemoryLimit is not supported on cgroups v2.
	//
	// Deprecated: This field is deprecated and will be removed in the next release.
	// Starting with kernel 6.12, the kernel has deprecated kernel memory tcp accounting
	KernelMemoryTCP    bool `json:",omitempty"` // KernelMemoryTCP is not supported on cgroups v2.
	CPUCfsPeriod       bool `json:"CpuCfsPeriod"`
	CPUCfsQuota        bool `json:"CpuCfsQuota"`
	CPUShares          bool
	CPUSet             bool
	PidsLimit          bool
	IPv4Forwarding     bool
	Debug              bool
	NFd                int
	OomKillDisable     bool
	NGoroutines        int
	SystemTime         string
	LoggingDriver      string
	CgroupDriver       string
	CgroupVersion      string `json:",omitempty"`
	NEventsListener    int
	KernelVersion      string
	OperatingSystem    string
	OSVersion          string
	OSType             string
	Architecture       string
	IndexServerAddress string
	RegistryConfig     *registry.ServiceConfig
	NCPU               int
	MemTotal           int64
	GenericResources   []swarm.GenericResource
	DockerRootDir      string
	HTTPProxy          string `json:"HttpProxy"`
	HTTPSProxy         string `json:"HttpsProxy"`
	NoProxy            string
	Name               string
	Labels             []string
	ExperimentalBuild  bool
	ServerVersion      string
	Runtimes           map[string]RuntimeWithStatus
	DefaultRuntime     string
	Swarm              swarm.Info
	// LiveRestoreEnabled determines whether containers should be kept
	// running when the daemon is shutdown or upon daemon start if
	// running containers are detected
	LiveRestoreEnabled  bool
	Isolation           container.Isolation
	InitBinary          string
	ContainerdCommit    Commit
	RuncCommit          Commit
	InitCommit          Commit
	SecurityOptions     []string
	ProductLicense      string               `json:",omitempty"`
	DefaultAddressPools []NetworkAddressPool `json:",omitempty"`
	FirewallBackend     *FirewallInfo        `json:"FirewallBackend,omitempty"`
	CDISpecDirs         []string
	DiscoveredDevices   []DeviceInfo `json:",omitempty"`

	Containerd *ContainerdInfo `json:",omitempty"`

	// Warnings contains a slice of warnings that occurred  while collecting
	// system information. These warnings are intended to be informational
	// messages for the user, and are not intended to be parsed / used for
	// other purposes, as they do not have a fixed format.
	Warnings []string
}

// ContainerdInfo holds information about the containerd instance used by the daemon.
type ContainerdInfo struct {
	// Address is the path to the containerd socket.
	Address string `json:",omitempty"`
	// Namespaces is the containerd namespaces used by the daemon.
	Namespaces ContainerdNamespaces
}

// ContainerdNamespaces reflects the containerd namespaces used by the daemon.
//
// These namespaces can be configured in the daemon configuration, and are
// considered to be used exclusively by the daemon,
//
// As these namespaces are considered to be exclusively accessed
// by the daemon, it is not recommended to change these values,
// or to change them to a value that is used by other systems,
// such as cri-containerd.
type ContainerdNamespaces struct {
	// Containers holds the default containerd namespace used for
	// containers managed by the daemon.
	//
	// The default namespace for containers is "moby", but will be
	// suffixed with the `<uid>.<gid>` of the remapped `root` if
	// user-namespaces are enabled and the containerd image-store
	// is used.
	Containers string

	// Plugins holds the default containerd namespace used for
	// plugins managed by the daemon.
	//
	// The default namespace for plugins is "moby", but will be
	// suffixed with the `<uid>.<gid>` of the remapped `root` if
	// user-namespaces are enabled and the containerd image-store
	// is used.
	Plugins string
}

// PluginsInfo is a temp struct holding Plugins name
// registered with docker daemon. It is used by [Info] struct
type PluginsInfo struct {
	// List of Volume plugins registered
	Volume []string
	// List of Network plugins registered
	Network []string
	// List of Authorization plugins registered
	Authorization []string
	// List of Log plugins registered
	Log []string
}

// Commit holds the Git-commit (SHA1) that a binary was built from, as reported
// in the version-string of external tools, such as containerd, or runC.
type Commit struct {
	// ID is the actual commit ID or version of external tool.
	ID string

	// Expected is the commit ID of external tool expected by dockerd as set at build time.
	//
	// Deprecated: this field is no longer used in API v1.49, but kept for backward-compatibility with older API versions.
	Expected string `json:",omitempty"`
}

// NetworkAddressPool is a temp struct used by [Info] struct.
type NetworkAddressPool struct {
	Base string
	Size int
}

// FirewallInfo describes the firewall backend.
type FirewallInfo struct {
	// Driver is the name of the firewall backend driver.
	Driver string `json:"Driver"`
	// Info is a list of label/value pairs, containing information related to the firewall.
	Info [][2]string `json:"Info,omitempty"`
}

// DeviceInfo represents a discoverable device from a device driver.
type DeviceInfo struct {
	// Source indicates the origin device driver.
	Source string `json:"Source"`
	// ID is the unique identifier for the device.
	// Example: CDI FQDN like "vendor.com/gpu=0", or other driver-specific device ID
	ID string `json:"ID"`
}