summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYong Tang <yong.tang.github@outlook.com>2016-03-29 04:10:37 +0000
committerYong Tang <yong.tang.github@outlook.com>2016-03-30 09:23:15 +0000
commit190654aa2ee880c2052c0887a215b85d24049f6d (patch)
treee979ebb9965202cbb9ae3a3bd9ba5072eca6a6b7
parent2f35c6b3fb4aad381ac3e47b17aef900600d7784 (diff)
downloaddocker-190654aa2ee880c2052c0887a215b85d24049f6d.tar.gz
Show "seccomp" in docker info (#20909).
This pull request added a `SecurityOptions` field in the `GET /info` output to show if there is `apparmor`, `seccomp`, or `selinux` suport. The API changes are updated in the documentation and the update in `GET /info` is covered by the test case in `TestInfoApi`. This pull request fixes #20909. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
-rw-r--r--daemon/info.go12
-rw-r--r--docs/reference/api/docker_remote_api.md1
-rw-r--r--docs/reference/api/docker_remote_api_v1.24.md5
-rw-r--r--integration-cli/docker_api_info_test.go3
4 files changed, 20 insertions, 1 deletions
diff --git a/daemon/info.go b/daemon/info.go
index 062b96493d..9ef74d2132 100644
--- a/daemon/info.go
+++ b/daemon/info.go
@@ -67,6 +67,17 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
}
})
+ var securityOptions []string
+ if sysInfo.AppArmor {
+ securityOptions = append(securityOptions, "apparmor")
+ }
+ if sysInfo.Seccomp {
+ securityOptions = append(securityOptions, "seccomp")
+ }
+ if selinuxEnabled() {
+ securityOptions = append(securityOptions, "selinux")
+ }
+
v := &types.Info{
ID: daemon.ID,
Containers: int(cRunning + cPaused + cStopped),
@@ -104,6 +115,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
HTTPProxy: sockets.GetProxyEnv("http_proxy"),
HTTPSProxy: sockets.GetProxyEnv("https_proxy"),
NoProxy: sockets.GetProxyEnv("no_proxy"),
+ SecurityOptions: securityOptions,
}
// TODO Windows. Refactor this more once sysinfo is refactored into
diff --git a/docs/reference/api/docker_remote_api.md b/docs/reference/api/docker_remote_api.md
index 59eccf1e66..a2b0a32559 100644
--- a/docs/reference/api/docker_remote_api.md
+++ b/docs/reference/api/docker_remote_api.md
@@ -117,6 +117,7 @@ This section lists each version from latest to oldest. Each listing includes a
[Docker Remote API v1.24](docker_remote_api_v1.24.md) documentation
* `POST /containers/create` now takes `StorageOpt` field.
+* `GET /info` now returns `SecurityOptions` field, showing if `apparmor`, `seccomp`, or `selinux` is supported.
### v1.23 API changes
diff --git a/docs/reference/api/docker_remote_api_v1.24.md b/docs/reference/api/docker_remote_api_v1.24.md
index a07c2dc3ae..68a5dca9ec 100644
--- a/docs/reference/api/docker_remote_api_v1.24.md
+++ b/docs/reference/api/docker_remote_api_v1.24.md
@@ -2239,6 +2239,11 @@ Display system-wide information
"127.0.0.0/8"
]
},
+ "SecurityOptions": [
+ "apparmor",
+ "seccomp",
+ "selinux"
+ ],
"ServerVersion": "1.9.0",
"SwapLimit": false,
"SystemStatus": [["State", "Healthy"]],
diff --git a/integration-cli/docker_api_info_test.go b/integration-cli/docker_api_info_test.go
index 9e6af66e5a..f80b8a198c 100644
--- a/integration-cli/docker_api_info_test.go
+++ b/integration-cli/docker_api_info_test.go
@@ -31,7 +31,8 @@ func (s *DockerSuite) TestInfoApi(c *check.C) {
"MemTotal",
"KernelVersion",
"Driver",
- "ServerVersion"}
+ "ServerVersion",
+ "SecurityOptions"}
out := string(body)
for _, linePrefix := range stringsToCheck {