Skip to content

Commit a3b9dd8

Browse files
committed
Fix seccomp output in docker info
This fix tries to address the issue raised in moby#24374 where `docker info` outputs seccomp support in Ubuntu 14.04 but the seccomp wass not actually supported. The issue is that in the current docker implementation, seccomp support is only checked against the kernel by inspect CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER. However, seccomp might not be enabled when building docker (through golang build flag). This fix adds a supportSeccomp boolean variable. The supportSeccomp is only set to true when seccomp is enabled when building docker. This fix fixes moby#24374. Signed-off-by: Yong Tang <[email protected]>
1 parent ad969f1 commit a3b9dd8

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

daemon/info.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
7171
if sysInfo.AppArmor {
7272
securityOptions = append(securityOptions, "apparmor")
7373
}
74-
if sysInfo.Seccomp {
74+
if sysInfo.Seccomp && supportsSeccomp {
7575
securityOptions = append(securityOptions, "seccomp")
7676
}
7777
if selinuxEnabled() {

daemon/seccomp_disabled.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// +build !seccomp,!windows
1+
// +build linux,!seccomp
22

33
package daemon
44

@@ -9,6 +9,8 @@ import (
99
"github.com/opencontainers/specs/specs-go"
1010
)
1111

12+
var supportsSeccomp = false
13+
1214
func setSeccomp(daemon *Daemon, rs *specs.Spec, c *container.Container) error {
1315
if c.SeccompProfile != "" && c.SeccompProfile != "unconfined" {
1416
return fmt.Errorf("seccomp profiles are not supported on this daemon, you cannot specify a custom seccomp profile")

daemon/seccomp_linux.go

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"github.com/opencontainers/specs/specs-go"
1212
)
1313

14+
var supportsSeccomp = true
15+
1416
func setSeccomp(daemon *Daemon, rs *specs.Spec, c *container.Container) error {
1517
var profile *specs.Seccomp
1618
var err error

daemon/seccomp_unsupported.go

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// +build !linux
2+
3+
package daemon
4+
5+
var supportsSeccomp = false

0 commit comments

Comments
 (0)