Browse Source

Add CgroupDriver to docker info

Fixes: #19539

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Qiang Huang 9 years ago
parent
commit
ca89c329b9

+ 1 - 0
api/client/info.go

@@ -50,6 +50,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
 	}
 	ioutils.FprintfIfNotEmpty(cli.out, "Execution Driver: %s\n", info.ExecutionDriver)
 	ioutils.FprintfIfNotEmpty(cli.out, "Logging Driver: %s\n", info.LoggingDriver)
+	ioutils.FprintfIfNotEmpty(cli.out, "Cgroup Driver: %s\n", info.CgroupDriver)
 
 	fmt.Fprintf(cli.out, "Plugins: \n")
 	fmt.Fprintf(cli.out, " Volume:")

+ 8 - 0
daemon/daemon_unix.go

@@ -362,6 +362,14 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
 	return warnings, nil
 }
 
+func (daemon *Daemon) getCgroupDriver() string {
+	cgroupDriver := "cgroupfs"
+	if daemon.usingSystemd() {
+		cgroupDriver = "systemd"
+	}
+	return cgroupDriver
+}
+
 func usingSystemd(config *Config) bool {
 	for _, option := range config.ExecOptions {
 		key, val, err := parsers.ParseKeyValueOpt(option)

+ 4 - 0
daemon/daemon_windows.go

@@ -65,6 +65,10 @@ func checkKernel() error {
 	return nil
 }
 
+func (daemon *Daemon) getCgroupDriver() string {
+	return ""
+}
+
 // adaptContainerSettings is called during container creation to modify any
 // settings necessary in the HostConfig structure.
 func (daemon *Daemon) adaptContainerSettings(hostConfig *containertypes.HostConfig, adjustCPUShares bool) error {

+ 1 - 0
daemon/info.go

@@ -83,6 +83,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
 		SystemTime:         time.Now().Format(time.RFC3339Nano),
 		ExecutionDriver:    daemon.ExecutionDriver().Name(),
 		LoggingDriver:      daemon.defaultLogConfig.Type,
+		CgroupDriver:       daemon.getCgroupDriver(),
 		NEventsListener:    daemon.EventsService.SubscribersCount(),
 		KernelVersion:      kernelVersion,
 		OperatingSystem:    operatingSystem,

+ 1 - 0
docs/reference/api/docker_remote_api.md

@@ -121,6 +121,7 @@ This section lists each version from latest to oldest.  Each listing includes a
 * `GET /networks/(name)` now returns an `EnableIPv6` field showing whether the network has ipv6 enabled or not.
 * `POST /containers/(name)/update` now supports updating container's restart policy.
 * `POST /networks/create` now supports enabling ipv6 on the network by setting the `EnableIPv6` field (doing this with a label will no longer work).
+* `GET /info` now returns `CgroupDriver` field showing what cgroup driver the daemon is using; `cgroupfs` or `systemd`.
 
 ### v1.22 API changes
 

+ 1 - 0
docs/reference/api/docker_remote_api_v1.23.md

@@ -2128,6 +2128,7 @@ Display system-wide information
 
     {
         "Architecture": "x86_64",
+        "CgroupDriver": "cgroupfs",
         "Containers": 11,
         "ContainersRunning": 7,
         "ContainersStopped": 3,

+ 1 - 0
docs/reference/commandline/info.md

@@ -33,6 +33,7 @@ For example:
      Dirperm1 Supported: true
     Execution Driver: native-0.2
     Logging Driver: json-file
+    Cgroup Driver: cgroupfs
     Plugins:
      Volume: local
      Network: bridge null host

+ 1 - 0
man/docker-info.1.md

@@ -42,6 +42,7 @@ Here is a sample output:
      Dirs: 80
     Execution Driver: native-0.2
     Logging Driver: json-file
+    Cgroup Driver: cgroupfs
     Plugins:
      Volume: local
      Network: bridge null host