diff --git a/api/swagger.yaml b/api/swagger.yaml index 5677340dbd..4192e55716 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -5436,6 +5436,35 @@ definitions: example: - "/etc/cdi" - "/var/run/cdi" + Containerd: + $ref: "#/definitions/ContainerdInfo" + x-nullable: true + + ContainerdInfo: + description: | + Information for connecting to the containerd instance that is used by the daemon. + This is included for debugging purposes only. + Tampering with the containerd instance may cause unexpected behavior. + type: "object" + properties: + Address: + description: "The address of the containerd socket." + type: "string" + Namespaces: + description: "The namespaces that are used by containerd." + type: "object" + properties: + Containers: + description: "The namespace that is used for containers." + type: "string" + Plugins: + description: "The namespace that is used for plugins." + type: "string" + example: + Address: "/run/containerd/containerd.sock" + Namespaces: + Containers: "moby" + Plugins: "plugins.moby" # PluginsInfo is a temp struct holding Plugins name # registered with docker daemon. It is used by Info struct diff --git a/api/types/system/info.go b/api/types/system/info.go index 89d4a0098e..65566607a9 100644 --- a/api/types/system/info.go +++ b/api/types/system/info.go @@ -75,6 +75,8 @@ type Info struct { DefaultAddressPools []NetworkAddressPool `json:",omitempty"` CDISpecDirs []string + Containerd *ContainerdInfo `json:",omitempty"` + // Legacy API fields for older API versions. legacyFields @@ -85,6 +87,20 @@ type Info struct { 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. +type ContainerdNamespaces struct { + Containers string + Plugins string +} + type legacyFields struct { ExecutionDriver string `json:",omitempty"` // Deprecated: deprecated since API v1.25, but returned for older versions. } diff --git a/daemon/info.go b/daemon/info.go index 8e56bd9a68..78c80461e2 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -227,6 +227,17 @@ func (daemon *Daemon) fillDebugInfo(ctx context.Context, v *system.Info) { v.NFd = fileutils.GetTotalUsedFds(ctx) v.NGoroutines = runtime.NumGoroutine() v.NEventsListener = daemon.EventsService.SubscribersCount() + + config := daemon.Config() + if config.ContainerdAddr != "" { + v.Containerd = &system.ContainerdInfo{ + Address: config.ContainerdAddr, + Namespaces: system.ContainerdNamespaces{ + Containers: config.ContainerdNamespace, + Plugins: config.ContainerdPluginNamespace, + }, + } + } } func (daemon *Daemon) fillAPIInfo(v *system.Info, cfg *config.Config) {