github.com/AbhinandanKurakure/podman/v3@v3.4.10/libpod/define/container_inspect.go (about) 1 package define 2 3 import ( 4 "time" 5 6 "github.com/containers/image/v5/manifest" 7 ) 8 9 // InspectContainerConfig holds further data about how a container was initially 10 // configured. 11 type InspectContainerConfig struct { 12 // Container hostname 13 Hostname string `json:"Hostname"` 14 // Container domain name - unused at present 15 DomainName string `json:"Domainname"` 16 // User the container was launched with 17 User string `json:"User"` 18 // Unused, at present 19 AttachStdin bool `json:"AttachStdin"` 20 // Unused, at present 21 AttachStdout bool `json:"AttachStdout"` 22 // Unused, at present 23 AttachStderr bool `json:"AttachStderr"` 24 // Whether the container creates a TTY 25 Tty bool `json:"Tty"` 26 // Whether the container leaves STDIN open 27 OpenStdin bool `json:"OpenStdin"` 28 // Whether STDIN is only left open once. 29 // Presently not supported by Podman, unused. 30 StdinOnce bool `json:"StdinOnce"` 31 // Container environment variables 32 Env []string `json:"Env"` 33 // Container command 34 Cmd []string `json:"Cmd"` 35 // Container image 36 Image string `json:"Image"` 37 // Unused, at present. I've never seen this field populated. 38 Volumes map[string]struct{} `json:"Volumes"` 39 // Container working directory 40 WorkingDir string `json:"WorkingDir"` 41 // Container entrypoint 42 Entrypoint string `json:"Entrypoint"` 43 // On-build arguments - presently unused. More of Buildah's domain. 44 OnBuild *string `json:"OnBuild"` 45 // Container labels 46 Labels map[string]string `json:"Labels"` 47 // Container annotations 48 Annotations map[string]string `json:"Annotations"` 49 // Container stop signal 50 StopSignal uint `json:"StopSignal"` 51 // Configured healthcheck for the container 52 Healthcheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"` 53 // CreateCommand is the full command plus arguments of the process the 54 // container has been created with. 55 CreateCommand []string `json:"CreateCommand,omitempty"` 56 // Timezone is the timezone inside the container. 57 // Local means it has the same timezone as the host machine 58 Timezone string `json:"Timezone,omitempty"` 59 // SystemdMode is whether the container is running in systemd mode. In 60 // systemd mode, the container configuration is customized to optimize 61 // running systemd in the container. 62 SystemdMode bool `json:"SystemdMode,omitempty"` 63 // Umask is the umask inside the container. 64 Umask string `json:"Umask,omitempty"` 65 // Secrets are the secrets mounted in the container 66 Secrets []*InspectSecret `json:"Secrets,omitempty"` 67 // Timeout is time before container is killed by conmon 68 Timeout uint `json:"Timeout"` 69 // StopTimeout is time before container is stopped when calling stop 70 StopTimeout uint `json:"StopTimeout"` 71 } 72 73 // InspectRestartPolicy holds information about the container's restart policy. 74 type InspectRestartPolicy struct { 75 // Name contains the container's restart policy. 76 // Allowable values are "no" or "" (take no action), 77 // "on-failure" (restart on non-zero exit code, with an optional max 78 // retry count), and "always" (always restart on container stop, unless 79 // explicitly requested by API). 80 // Note that this is NOT actually a name of any sort - the poor naming 81 // is for Docker compatibility. 82 Name string `json:"Name"` 83 // MaximumRetryCount is the maximum number of retries allowed if the 84 // "on-failure" restart policy is in use. Not used if "on-failure" is 85 // not set. 86 MaximumRetryCount uint `json:"MaximumRetryCount"` 87 } 88 89 // InspectLogConfig holds information about a container's configured log driver 90 type InspectLogConfig struct { 91 Type string `json:"Type"` 92 Config map[string]string `json:"Config"` //idk type, TODO 93 // Path specifies a path to the log file 94 Path string `json:"Path"` 95 // Tag specifies a custom log tag for the container 96 Tag string `json:"Tag"` 97 // Size specifies a maximum size of the container log 98 Size string `json:"Size"` 99 } 100 101 // InspectBlkioWeightDevice holds information about the relative weight 102 // of an individual device node. Weights are used in the I/O scheduler to give 103 // relative priority to some accesses. 104 type InspectBlkioWeightDevice struct { 105 // Path is the path to the device this applies to. 106 Path string `json:"Path"` 107 // Weight is the relative weight the scheduler will use when scheduling 108 // I/O. 109 Weight uint16 `json:"Weight"` 110 } 111 112 // InspectBlkioThrottleDevice holds information about a speed cap for a device 113 // node. This cap applies to a specific operation (read, write, etc) on the given 114 // node. 115 type InspectBlkioThrottleDevice struct { 116 // Path is the path to the device this applies to. 117 Path string `json:"Path"` 118 // Rate is the maximum rate. It is in either bytes per second or iops 119 // per second, determined by where it is used - documentation will 120 // indicate which is appropriate. 121 Rate uint64 `json:"Rate"` 122 } 123 124 // InspectUlimit is a ulimit that will be applied to the container. 125 type InspectUlimit struct { 126 // Name is the name (type) of the ulimit. 127 Name string `json:"Name"` 128 // Soft is the soft limit that will be applied. 129 Soft int64 `json:"Soft"` 130 // Hard is the hard limit that will be applied. 131 Hard int64 `json:"Hard"` 132 } 133 134 // InspectDevice is a single device that will be mounted into the container. 135 type InspectDevice struct { 136 // PathOnHost is the path of the device on the host. 137 PathOnHost string `json:"PathOnHost"` 138 // PathInContainer is the path of the device within the container. 139 PathInContainer string `json:"PathInContainer"` 140 // CgroupPermissions is the permissions of the mounted device. 141 // Presently not populated. 142 // TODO. 143 CgroupPermissions string `json:"CgroupPermissions"` 144 } 145 146 // InspectHostPort provides information on a port on the host that a container's 147 // port is bound to. 148 type InspectHostPort struct { 149 // IP on the host we are bound to. "" if not specified (binding to all 150 // IPs). 151 HostIP string `json:"HostIp"` 152 // Port on the host we are bound to. No special formatting - just an 153 // integer stuffed into a string. 154 HostPort string `json:"HostPort"` 155 } 156 157 // InspectMount provides a record of a single mount in a container. It contains 158 // fields for both named and normal volumes. Only user-specified volumes will be 159 // included, and tmpfs volumes are not included even if the user specified them. 160 type InspectMount struct { 161 // Whether the mount is a volume or bind mount. Allowed values are 162 // "volume" and "bind". 163 Type string `json:"Type"` 164 // The name of the volume. Empty for bind mounts. 165 Name string `json:"Name,omitempty"` 166 // The source directory for the volume. 167 Source string `json:"Source"` 168 // The destination directory for the volume. Specified as a path within 169 // the container, as it would be passed into the OCI runtime. 170 Destination string `json:"Destination"` 171 // The driver used for the named volume. Empty for bind mounts. 172 Driver string `json:"Driver"` 173 // Contains SELinux :z/:Z mount options. Unclear what, if anything, else 174 // goes in here. 175 Mode string `json:"Mode"` 176 // All remaining mount options. Additional data, not present in the 177 // original output. 178 Options []string `json:"Options"` 179 // Whether the volume is read-write 180 RW bool `json:"RW"` 181 // Mount propagation for the mount. Can be empty if not specified, but 182 // is always printed - no omitempty. 183 Propagation string `json:"Propagation"` 184 } 185 186 // InspectContainerState provides a detailed record of a container's current 187 // state. It is returned as part of InspectContainerData. 188 // As with InspectContainerData, many portions of this struct are matched to 189 // Docker, but here we see more fields that are unused (nonsensical in the 190 // context of Libpod). 191 type InspectContainerState struct { 192 OciVersion string `json:"OciVersion"` 193 Status string `json:"Status"` 194 Running bool `json:"Running"` 195 Paused bool `json:"Paused"` 196 Restarting bool `json:"Restarting"` // TODO 197 OOMKilled bool `json:"OOMKilled"` 198 Dead bool `json:"Dead"` 199 Pid int `json:"Pid"` 200 ConmonPid int `json:"ConmonPid,omitempty"` 201 ExitCode int32 `json:"ExitCode"` 202 Error string `json:"Error"` // TODO 203 StartedAt time.Time `json:"StartedAt"` 204 FinishedAt time.Time `json:"FinishedAt"` 205 Healthcheck HealthCheckResults `json:"Healthcheck,omitempty"` 206 Checkpointed bool `json:"Checkpointed,omitempty"` 207 CgroupPath string `json:"CgroupPath,omitempty"` 208 } 209 210 // HealthCheckResults describes the results/logs from a healthcheck 211 type HealthCheckResults struct { 212 // Status healthy or unhealthy 213 Status string `json:"Status"` 214 // FailingStreak is the number of consecutive failed healthchecks 215 FailingStreak int `json:"FailingStreak"` 216 // Log describes healthcheck attempts and results 217 Log []HealthCheckLog `json:"Log"` 218 } 219 220 // HealthCheckLog describes the results of a single healthcheck 221 type HealthCheckLog struct { 222 // Start time as string 223 Start string `json:"Start"` 224 // End time as a string 225 End string `json:"End"` 226 // Exitcode is 0 or 1 227 ExitCode int `json:"ExitCode"` 228 // Output is the stdout/stderr from the healthcheck command 229 Output string `json:"Output"` 230 } 231 232 // InspectContainerHostConfig holds information used when the container was 233 // created. 234 // It's very much a Docker-specific struct, retained (mostly) as-is for 235 // compatibility. We fill individual fields as best as we can, inferring as much 236 // as possible from the spec and container config. 237 // Some things cannot be inferred. These will be populated by spec annotations 238 // (if available). 239 // Field names are fixed for compatibility and cannot be changed. 240 // As such, silence lint warnings about them. 241 //nolint 242 type InspectContainerHostConfig struct { 243 // Binds contains an array of user-added mounts. 244 // Both volume mounts and named volumes are included. 245 // Tmpfs mounts are NOT included. 246 // In 'docker inspect' this is separated into 'Binds' and 'Mounts' based 247 // on how a mount was added. We do not make this distinction and do not 248 // include a Mounts field in inspect. 249 // Format: <src>:<destination>[:<comma-separated options>] 250 Binds []string `json:"Binds"` 251 // CgroupManager is the cgroup manager used by the container. 252 // At present, allowed values are either "cgroupfs" or "systemd". 253 CgroupManager string `json:"CgroupManager,omitempty"` 254 // CgroupMode is the configuration of the container's cgroup namespace. 255 // Populated as follows: 256 // private - a cgroup namespace has been created 257 // host - No cgroup namespace created 258 // container:<id> - Using another container's cgroup namespace 259 // ns:<path> - A path to a cgroup namespace has been specified 260 CgroupMode string `json:"CgroupMode"` 261 // ContainerIDFile is a file created during container creation to hold 262 // the ID of the created container. 263 // This is not handled within libpod and is stored in an annotation. 264 ContainerIDFile string `json:"ContainerIDFile"` 265 // LogConfig contains information on the container's logging backend 266 LogConfig *InspectLogConfig `json:"LogConfig"` 267 // NetworkMode is the configuration of the container's network 268 // namespace. 269 // Populated as follows: 270 // default - A network namespace is being created and configured via CNI 271 // none - A network namespace is being created, not configured via CNI 272 // host - No network namespace created 273 // container:<id> - Using another container's network namespace 274 // ns:<path> - A path to a network namespace has been specified 275 NetworkMode string `json:"NetworkMode"` 276 // PortBindings contains the container's port bindings. 277 // It is formatted as map[string][]InspectHostPort. 278 // The string key here is formatted as <integer port number>/<protocol> 279 // and represents the container port. A single container port may be 280 // bound to multiple host ports (on different IPs). 281 PortBindings map[string][]InspectHostPort `json:"PortBindings"` 282 // RestartPolicy contains the container's restart policy. 283 RestartPolicy *InspectRestartPolicy `json:"RestartPolicy"` 284 // AutoRemove is whether the container will be automatically removed on 285 // exiting. 286 // It is not handled directly within libpod and is stored in an 287 // annotation. 288 AutoRemove bool `json:"AutoRemove"` 289 // VolumeDriver is presently unused and is retained for Docker 290 // compatibility. 291 VolumeDriver string `json:"VolumeDriver"` 292 // VolumesFrom is a list of containers which this container uses volumes 293 // from. This is not handled directly within libpod and is stored in an 294 // annotation. 295 // It is formatted as an array of container names and IDs. 296 VolumesFrom []string `json:"VolumesFrom"` 297 // CapAdd is a list of capabilities added to the container. 298 // It is not directly stored by Libpod, and instead computed from the 299 // capabilities listed in the container's spec, compared against a set 300 // of default capabilities. 301 CapAdd []string `json:"CapAdd"` 302 // CapDrop is a list of capabilities removed from the container. 303 // It is not directly stored by libpod, and instead computed from the 304 // capabilities listed in the container's spec, compared against a set 305 // of default capabilities. 306 CapDrop []string `json:"CapDrop"` 307 // Dns is a list of DNS nameservers that will be added to the 308 // container's resolv.conf 309 Dns []string `json:"Dns"` 310 // DnsOptions is a list of DNS options that will be set in the 311 // container's resolv.conf 312 DnsOptions []string `json:"DnsOptions"` 313 // DnsSearch is a list of DNS search domains that will be set in the 314 // container's resolv.conf 315 DnsSearch []string `json:"DnsSearch"` 316 // ExtraHosts contains hosts that will be aded to the container's 317 // /etc/hosts. 318 ExtraHosts []string `json:"ExtraHosts"` 319 // GroupAdd contains groups that the user inside the container will be 320 // added to. 321 GroupAdd []string `json:"GroupAdd"` 322 // IpcMode represents the configuration of the container's IPC 323 // namespace. 324 // Populated as follows: 325 // "" (empty string) - Default, an IPC namespace will be created 326 // host - No IPC namespace created 327 // container:<id> - Using another container's IPC namespace 328 // ns:<path> - A path to an IPC namespace has been specified 329 IpcMode string `json:"IpcMode"` 330 // Cgroup contains the container's cgroup. It is presently not 331 // populated. 332 // TODO. 333 Cgroup string `json:"Cgroup"` 334 // Cgroups contains the container's CGroup mode. 335 // Allowed values are "default" (container is creating CGroups) and 336 // "disabled" (container is not creating CGroups). 337 // This is Libpod-specific and not included in `docker inspect`. 338 Cgroups string `json:"Cgroups"` 339 // Links is unused, and provided purely for Docker compatibility. 340 Links []string `json:"Links"` 341 // OOMScoreAdj is an adjustment that will be made to the container's OOM 342 // score. 343 OomScoreAdj int `json:"OomScoreAdj"` 344 // PidMode represents the configuration of the container's PID 345 // namespace. 346 // Populated as follows: 347 // "" (empty string) - Default, a PID namespace will be created 348 // host - No PID namespace created 349 // container:<id> - Using another container's PID namespace 350 // ns:<path> - A path to a PID namespace has been specified 351 PidMode string `json:"PidMode"` 352 // Privileged indicates whether the container is running with elevated 353 // privileges. 354 // This has a very specific meaning in the Docker sense, so it's very 355 // difficult to decode from the spec and config, and so is stored as an 356 // annotation. 357 Privileged bool `json:"Privileged"` 358 // PublishAllPorts indicates whether image ports are being published. 359 // This is not directly stored in libpod and is saved as an annotation. 360 PublishAllPorts bool `json:"PublishAllPorts"` 361 // ReadonlyRootfs is whether the container will be mounted read-only. 362 ReadonlyRootfs bool `json:"ReadonlyRootfs"` 363 // SecurityOpt is a list of security-related options that are set in the 364 // container. 365 SecurityOpt []string `json:"SecurityOpt"` 366 // Tmpfs is a list of tmpfs filesystems that will be mounted into the 367 // container. 368 // It is a map of destination path to options for the mount. 369 Tmpfs map[string]string `json:"Tmpfs"` 370 // UTSMode represents the configuration of the container's UID 371 // namespace. 372 // Populated as follows: 373 // "" (empty string) - Default, a UTS namespace will be created 374 // host - no UTS namespace created 375 // container:<id> - Using another container's UTS namespace 376 // ns:<path> - A path to a UTS namespace has been specified 377 UTSMode string `json:"UTSMode"` 378 // UsernsMode represents the configuration of the container's user 379 // namespace. 380 // When running rootless, a user namespace is created outside of libpod 381 // to allow some privileged operations. This will not be reflected here. 382 // Populated as follows: 383 // "" (empty string) - No user namespace will be created 384 // private - The container will be run in a user namespace 385 // container:<id> - Using another container's user namespace 386 // ns:<path> - A path to a user namespace has been specified 387 // TODO Rootless has an additional 'keep-id' option, presently not 388 // reflected here. 389 UsernsMode string `json:"UsernsMode"` 390 // ShmSize is the size of the container's SHM device. 391 ShmSize int64 `json:"ShmSize"` 392 // Runtime is provided purely for Docker compatibility. 393 // It is set unconditionally to "oci" as Podman does not presently 394 // support non-OCI runtimes. 395 Runtime string `json:"Runtime"` 396 // ConsoleSize is an array of 2 integers showing the size of the 397 // container's console. 398 // It is only set if the container is creating a terminal. 399 // TODO. 400 ConsoleSize []uint `json:"ConsoleSize"` 401 // Isolation is presently unused and provided solely for Docker 402 // compatibility. 403 Isolation string `json:"Isolation"` 404 // CpuShares indicates the CPU resources allocated to the container. 405 // It is a relative weight in the scheduler for assigning CPU time 406 // versus other CGroups. 407 CpuShares uint64 `json:"CpuShares"` 408 // Memory indicates the memory resources allocated to the container. 409 // This is the limit (in bytes) of RAM the container may use. 410 Memory int64 `json:"Memory"` 411 // NanoCpus indicates number of CPUs allocated to the container. 412 // It is an integer where one full CPU is indicated by 1000000000 (one 413 // billion). 414 // Thus, 2.5 CPUs (fractional portions of CPUs are allowed) would be 415 // 2500000000 (2.5 billion). 416 // In 'docker inspect' this is set exclusively of two further options in 417 // the output (CpuPeriod and CpuQuota) which are both used to implement 418 // this functionality. 419 // We can't distinguish here, so if CpuQuota is set to the default of 420 // 100000, we will set both CpuQuota, CpuPeriod, and NanoCpus. If 421 // CpuQuota is not the default, we will not set NanoCpus. 422 NanoCpus int64 `json:"NanoCpus"` 423 // CgroupParent is the CGroup parent of the container. 424 // Only set if not default. 425 CgroupParent string `json:"CgroupParent"` 426 // BlkioWeight indicates the I/O resources allocated to the container. 427 // It is a relative weight in the scheduler for assigning I/O time 428 // versus other CGroups. 429 BlkioWeight uint16 `json:"BlkioWeight"` 430 // BlkioWeightDevice is an array of I/O resource priorities for 431 // individual device nodes. 432 // Unfortunately, the spec only stores the device's Major/Minor numbers 433 // and not the path, which is used here. 434 // Fortunately, the kernel provides an interface for retrieving the path 435 // of a given node by major:minor at /sys/dev/. However, the exact path 436 // in use may not be what was used in the original CLI invocation - 437 // though it is guaranteed that the device node will be the same, and 438 // using the given path will be functionally identical. 439 BlkioWeightDevice []InspectBlkioWeightDevice `json:"BlkioWeightDevice"` 440 // BlkioDeviceReadBps is an array of I/O throttle parameters for 441 // individual device nodes. 442 // This specifically sets read rate cap in bytes per second for device 443 // nodes. 444 // As with BlkioWeightDevice, we pull the path from /sys/dev, and we 445 // don't guarantee the path will be identical to the original (though 446 // the node will be). 447 BlkioDeviceReadBps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadBps"` 448 // BlkioDeviceWriteBps is an array of I/O throttle parameters for 449 // individual device nodes. 450 // this specifically sets write rate cap in bytes per second for device 451 // nodes. 452 // as with BlkioWeightDevice, we pull the path from /sys/dev, and we 453 // don't guarantee the path will be identical to the original (though 454 // the node will be). 455 BlkioDeviceWriteBps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteBps"` 456 // BlkioDeviceReadIOps is an array of I/O throttle parameters for 457 // individual device nodes. 458 // This specifically sets the read rate cap in iops per second for 459 // device nodes. 460 // As with BlkioWeightDevice, we pull the path from /sys/dev, and we 461 // don't guarantee the path will be identical to the original (though 462 // the node will be). 463 BlkioDeviceReadIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceReadIOps"` 464 // BlkioDeviceWriteIOps is an array of I/O throttle parameters for 465 // individual device nodes. 466 // This specifically sets the write rate cap in iops per second for 467 // device nodes. 468 // As with BlkioWeightDevice, we pull the path from /sys/dev, and we 469 // don't guarantee the path will be identical to the original (though 470 // the node will be). 471 BlkioDeviceWriteIOps []InspectBlkioThrottleDevice `json:"BlkioDeviceWriteIOps"` 472 // CpuPeriod is the length of a CPU period in microseconds. 473 // It relates directly to CpuQuota. 474 CpuPeriod uint64 `json:"CpuPeriod"` 475 // CpuPeriod is the amount of time (in microseconds) that a container 476 // can use the CPU in every CpuPeriod. 477 CpuQuota int64 `json:"CpuQuota"` 478 // CpuRealtimePeriod is the length of time (in microseconds) of the CPU 479 // realtime period. If set to 0, no time will be allocated to realtime 480 // tasks. 481 CpuRealtimePeriod uint64 `json:"CpuRealtimePeriod"` 482 // CpuRealtimeRuntime is the length of time (in microseconds) allocated 483 // for realtime tasks within every CpuRealtimePeriod. 484 CpuRealtimeRuntime int64 `json:"CpuRealtimeRuntime"` 485 // CpusetCpus is the is the set of CPUs that the container will execute 486 // on. Formatted as `0-3` or `0,2`. Default (if unset) is all CPUs. 487 CpusetCpus string `json:"CpusetCpus"` 488 // CpusetMems is the set of memory nodes the container will use. 489 // Formatted as `0-3` or `0,2`. Default (if unset) is all memory nodes. 490 CpusetMems string `json:"CpusetMems"` 491 // Devices is a list of device nodes that will be added to the 492 // container. 493 // These are stored in the OCI spec only as type, major, minor while we 494 // display the host path. We convert this with /sys/dev, but we cannot 495 // guarantee that the host path will be identical - only that the actual 496 // device will be. 497 Devices []InspectDevice `json:"Devices"` 498 // DiskQuota is the maximum amount of disk space the container may use 499 // (in bytes). 500 // Presently not populated. 501 // TODO. 502 DiskQuota uint64 `json:"DiskQuota"` 503 // KernelMemory is the maximum amount of memory the kernel will devote 504 // to the container. 505 KernelMemory int64 `json:"KernelMemory"` 506 // MemoryReservation is the reservation (soft limit) of memory available 507 // to the container. Soft limits are warnings only and can be exceeded. 508 MemoryReservation int64 `json:"MemoryReservation"` 509 // MemorySwap is the total limit for all memory available to the 510 // container, including swap. 0 indicates that there is no limit to the 511 // amount of memory available. 512 MemorySwap int64 `json:"MemorySwap"` 513 // MemorySwappiness is the willingness of the kernel to page container 514 // memory to swap. It is an integer from 0 to 100, with low numbers 515 // being more likely to be put into swap. 516 // -1, the default, will not set swappiness and use the system defaults. 517 MemorySwappiness int64 `json:"MemorySwappiness"` 518 // OomKillDisable indicates whether the kernel OOM killer is disabled 519 // for the container. 520 OomKillDisable bool `json:"OomKillDisable"` 521 // Init indicates whether the container has an init mounted into it. 522 Init bool `json:"Init,omitempty"` 523 // PidsLimit is the maximum number of PIDs what may be created within 524 // the container. 0, the default, indicates no limit. 525 PidsLimit int64 `json:"PidsLimit"` 526 // Ulimits is a set of ulimits that will be set within the container. 527 Ulimits []InspectUlimit `json:"Ulimits"` 528 // CpuCount is Windows-only and not presently implemented. 529 CpuCount uint64 `json:"CpuCount"` 530 // CpuPercent is Windows-only and not presently implemented. 531 CpuPercent uint64 `json:"CpuPercent"` 532 // IOMaximumIOps is Windows-only and not presently implemented. 533 IOMaximumIOps uint64 `json:"IOMaximumIOps"` 534 // IOMaximumBandwidth is Windows-only and not presently implemented. 535 IOMaximumBandwidth uint64 `json:"IOMaximumBandwidth"` 536 // CgroupConf is the configuration for cgroup v2. 537 CgroupConf map[string]string `json:"CgroupConf"` 538 } 539 540 // InspectBasicNetworkConfig holds basic configuration information (e.g. IP 541 // addresses, MAC address, subnet masks, etc) that are common for all networks 542 // (both additional and main). 543 type InspectBasicNetworkConfig struct { 544 // EndpointID is unused, maintained exclusively for compatibility. 545 EndpointID string `json:"EndpointID"` 546 // Gateway is the IP address of the gateway this network will use. 547 Gateway string `json:"Gateway"` 548 // IPAddress is the IP address for this network. 549 IPAddress string `json:"IPAddress"` 550 // IPPrefixLen is the length of the subnet mask of this network. 551 IPPrefixLen int `json:"IPPrefixLen"` 552 // SecondaryIPAddresses is a list of extra IP Addresses that the 553 // container has been assigned in this network. 554 SecondaryIPAddresses []string `json:"SecondaryIPAddresses,omitempty"` 555 // IPv6Gateway is the IPv6 gateway this network will use. 556 IPv6Gateway string `json:"IPv6Gateway"` 557 // GlobalIPv6Address is the global-scope IPv6 Address for this network. 558 GlobalIPv6Address string `json:"GlobalIPv6Address"` 559 // GlobalIPv6PrefixLen is the length of the subnet mask of this network. 560 GlobalIPv6PrefixLen int `json:"GlobalIPv6PrefixLen"` 561 // SecondaryIPv6Addresses is a list of extra IPv6 Addresses that the 562 // container has been assigned in this network. 563 SecondaryIPv6Addresses []string `json:"SecondaryIPv6Addresses,omitempty"` 564 // MacAddress is the MAC address for the interface in this network. 565 MacAddress string `json:"MacAddress"` 566 // AdditionalMacAddresses is a set of additional MAC Addresses beyond 567 // the first. CNI may configure more than one interface for a single 568 // network, which can cause this. 569 AdditionalMacAddresses []string `json:"AdditionalMACAddresses,omitempty"` 570 } 571 572 // InspectAdditionalNetwork holds information about non-default CNI networks the 573 // container has been connected to. 574 // As with InspectNetworkSettings, many fields are unused and maintained only 575 // for compatibility with Docker. 576 type InspectAdditionalNetwork struct { 577 InspectBasicNetworkConfig 578 579 // Name of the network we're connecting to. 580 NetworkID string `json:"NetworkID,omitempty"` 581 // DriverOpts is presently unused and maintained exclusively for 582 // compatibility. 583 DriverOpts map[string]string `json:"DriverOpts"` 584 // IPAMConfig is presently unused and maintained exclusively for 585 // compatibility. 586 IPAMConfig map[string]string `json:"IPAMConfig"` 587 // Links is presently unused and maintained exclusively for 588 // compatibility. 589 Links []string `json:"Links"` 590 // Aliases are any network aliases the container has in this network. 591 Aliases []string `json:"Aliases,omitempty"` 592 } 593 594 // InspectNetworkSettings holds information about the network settings of the 595 // container. 596 // Many fields are maintained only for compatibility with `docker inspect` and 597 // are unused within Libpod. 598 type InspectNetworkSettings struct { 599 InspectBasicNetworkConfig 600 601 Bridge string `json:"Bridge"` 602 SandboxID string `json:"SandboxID"` 603 HairpinMode bool `json:"HairpinMode"` 604 LinkLocalIPv6Address string `json:"LinkLocalIPv6Address"` 605 LinkLocalIPv6PrefixLen int `json:"LinkLocalIPv6PrefixLen"` 606 Ports map[string][]InspectHostPort `json:"Ports"` 607 SandboxKey string `json:"SandboxKey"` 608 // Networks contains information on non-default CNI networks this 609 // container has joined. 610 // It is a map of network name to network information. 611 Networks map[string]*InspectAdditionalNetwork `json:"Networks,omitempty"` 612 } 613 614 // InspectContainerData provides a detailed record of a container's configuration 615 // and state as viewed by Libpod. 616 // Large portions of this structure are defined such that the output is 617 // compatible with `docker inspect` JSON, but additional fields have been added 618 // as required to share information not in the original output. 619 type InspectContainerData struct { 620 ID string `json:"Id"` 621 Created time.Time `json:"Created"` 622 Path string `json:"Path"` 623 Args []string `json:"Args"` 624 State *InspectContainerState `json:"State"` 625 Image string `json:"Image"` 626 ImageName string `json:"ImageName"` 627 Rootfs string `json:"Rootfs"` 628 Pod string `json:"Pod"` 629 ResolvConfPath string `json:"ResolvConfPath"` 630 HostnamePath string `json:"HostnamePath"` 631 HostsPath string `json:"HostsPath"` 632 StaticDir string `json:"StaticDir"` 633 OCIConfigPath string `json:"OCIConfigPath,omitempty"` 634 OCIRuntime string `json:"OCIRuntime,omitempty"` 635 ConmonPidFile string `json:"ConmonPidFile"` 636 PidFile string `json:"PidFile"` 637 Name string `json:"Name"` 638 RestartCount int32 `json:"RestartCount"` 639 Driver string `json:"Driver"` 640 MountLabel string `json:"MountLabel"` 641 ProcessLabel string `json:"ProcessLabel"` 642 AppArmorProfile string `json:"AppArmorProfile"` 643 EffectiveCaps []string `json:"EffectiveCaps"` 644 BoundingCaps []string `json:"BoundingCaps"` 645 ExecIDs []string `json:"ExecIDs"` 646 GraphDriver *DriverData `json:"GraphDriver"` 647 SizeRw *int64 `json:"SizeRw,omitempty"` 648 SizeRootFs int64 `json:"SizeRootFs,omitempty"` 649 Mounts []InspectMount `json:"Mounts"` 650 Dependencies []string `json:"Dependencies"` 651 NetworkSettings *InspectNetworkSettings `json:"NetworkSettings"` //TODO 652 ExitCommand []string `json:"ExitCommand"` 653 Namespace string `json:"Namespace"` 654 IsInfra bool `json:"IsInfra"` 655 Config *InspectContainerConfig `json:"Config"` 656 HostConfig *InspectContainerHostConfig `json:"HostConfig"` 657 } 658 659 // InspectExecSession contains information about a given exec session. 660 type InspectExecSession struct { 661 // CanRemove is legacy and used purely for compatibility reasons. 662 // Will always be set to true, unless the exec session is running. 663 CanRemove bool `json:"CanRemove"` 664 // ContainerID is the ID of the container this exec session is attached 665 // to. 666 ContainerID string `json:"ContainerID"` 667 // DetachKeys are the detach keys used by the exec session. 668 // If set to "" the default keys are being used. 669 // Will show "<none>" if no detach keys are set. 670 DetachKeys string `json:"DetachKeys"` 671 // ExitCode is the exit code of the exec session. Will be set to 0 if 672 // the exec session has not yet exited. 673 ExitCode int `json:"ExitCode"` 674 // ID is the ID of the exec session. 675 ID string `json:"ID"` 676 // OpenStderr is whether the container's STDERR stream will be attached. 677 // Always set to true if the exec session created a TTY. 678 OpenStderr bool `json:"OpenStderr"` 679 // OpenStdin is whether the container's STDIN stream will be attached 680 // to. 681 OpenStdin bool `json:"OpenStdin"` 682 // OpenStdout is whether the container's STDOUT stream will be attached. 683 // Always set to true if the exec session created a TTY. 684 OpenStdout bool `json:"OpenStdout"` 685 // Running is whether the exec session is running. 686 Running bool `json:"Running"` 687 // Pid is the PID of the exec session's process. 688 // Will be set to 0 if the exec session is not running. 689 Pid int `json:"Pid"` 690 // ProcessConfig contains information about the exec session's process. 691 ProcessConfig *InspectExecProcess `json:"ProcessConfig"` 692 } 693 694 // InspectExecProcess contains information about the process in a given exec 695 // session. 696 type InspectExecProcess struct { 697 // Arguments are the arguments to the entrypoint command of the exec 698 // session. 699 Arguments []string `json:"arguments"` 700 // Entrypoint is the entrypoint for the exec session (the command that 701 // will be executed in the container). 702 Entrypoint string `json:"entrypoint"` 703 // Privileged is whether the exec session will be started with elevated 704 // privileges. 705 Privileged bool `json:"privileged"` 706 // Tty is whether the exec session created a terminal. 707 Tty bool `json:"tty"` 708 // User is the user the exec session was started as. 709 User string `json:"user"` 710 } 711 712 // DriverData handles the data for a storage driver 713 type DriverData struct { 714 Name string `json:"Name"` 715 Data map[string]string `json:"Data"` 716 } 717 718 // InspectSecret contains information on secrets mounted inside the container 719 type InspectSecret struct { 720 // Name is the name of the secret 721 Name string `json:"Name"` 722 // ID is the ID of the secret 723 ID string `json:"ID"` 724 // ID is the UID of the mounted secret file 725 UID uint32 `json:"UID"` 726 // ID is the GID of the mounted secret file 727 GID uint32 `json:"GID"` 728 // ID is the ID of the mode of the mounted secret file 729 Mode uint32 `json:"Mode"` 730 }