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