github.com/containerd/nerdctl/v2@v2.0.0-beta.5.0.20240520001846-b5758f54fa28/pkg/inspecttypes/dockercompat/info.go (about) 1 /* 2 Copyright The containerd Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 /* 18 Portions from https://github.com/moby/moby/blob/v20.10.8/api/types/types.go 19 Portions from https://github.com/docker/cli/blob/v20.10.8/cli/command/system/version.go 20 Copyright (C) Docker/Moby authors. 21 Licensed under the Apache License, Version 2.0 22 NOTICE: https://github.com/moby/moby/blob/v20.10.8/NOTICE , https://github.com/docker/cli/blob/v20.10.8/NOTICE 23 */ 24 25 package dockercompat 26 27 // Info mimics a `docker info` object. 28 // From https://github.com/moby/moby/blob/v20.10.8/api/types/types.go#L146-L216 29 type Info struct { 30 ID string 31 Driver string 32 Plugins PluginsInfo 33 MemoryLimit bool 34 SwapLimit bool 35 // KernelMemory is omitted because it is deprecated in the Moby 36 CPUCfsPeriod bool `json:"CpuCfsPeriod"` 37 CPUCfsQuota bool `json:"CpuCfsQuota"` 38 CPUShares bool 39 CPUSet bool 40 PidsLimit bool 41 IPv4Forwarding bool 42 BridgeNfIptables bool 43 BridgeNfIP6tables bool `json:"BridgeNfIp6tables"` 44 // Nfd is omitted because it does not make sense for nerdctl 45 OomKillDisable bool 46 // NGoroutines is omitted because it does not make sense for nerdctl 47 SystemTime string 48 LoggingDriver string 49 CgroupDriver string 50 CgroupVersion string `json:",omitempty"` 51 // NEventsListener is omitted because it does not make sense for nerdctl 52 KernelVersion string 53 OperatingSystem string 54 OSType string 55 Architecture string // e.g., "x86_64", not "amd64" (Corresponds to Docker) 56 NCPU int 57 MemTotal int64 58 Name string 59 ServerVersion string 60 SecurityOptions []string 61 62 Warnings []string 63 } 64 65 type PluginsInfo struct { 66 Log []string 67 Storage []string // nerdctl extension 68 } 69 70 // VersionInfo mimics a `docker version` object. 71 // From https://github.com/docker/cli/blob/v20.10.8/cli/command/system/version.go#L68-L72 72 type VersionInfo struct { 73 Client ClientVersion 74 Server *ServerVersion 75 } 76 77 // ClientVersion is from https://github.com/docker/cli/blob/v20.10.8/cli/command/system/version.go#L74-L87 78 type ClientVersion struct { 79 Version string 80 GitCommit string 81 GoVersion string 82 Os string // GOOS 83 Arch string // GOARCH 84 Components []ComponentVersion // nerdctl extension 85 } 86 87 // ComponentVersion describes the version information for a specific component. 88 // From https://github.com/moby/moby/blob/v20.10.8/api/types/types.go#L112-L117 89 type ComponentVersion struct { 90 Name string 91 Version string 92 Details map[string]string `json:",omitempty"` 93 } 94 95 // ServerVersion is from https://github.com/moby/moby/blob/v20.10.8/api/types/types.go#L119-L137 96 type ServerVersion struct { 97 Components []ComponentVersion 98 // Deprecated fields are not added here 99 }