Skip to content

Commit de191e8

Browse files
committed
skip apparmor with dind
Docker-DCO-1.1-Signed-off-by: Victor Vieux <[email protected]> (github: vieux)
1 parent ae686c0 commit de191e8

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

hack/dind

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
# Usage: dind CMD [ARG...]
1111

12+
# apparmor sucks and Docker needs to know that it's in a container (c) @tianon
13+
export container=docker
14+
1215
# First, make sure that cgroups are mounted correctly.
1316
CGROUP=/sys/fs/cgroup
1417

pkg/apparmor/apparmor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
func IsEnabled() bool {
16-
if _, err := os.Stat("/sys/kernel/security/apparmor"); err == nil {
16+
if _, err := os.Stat("/sys/kernel/security/apparmor"); err == nil && os.Getenv("container") == "" {
1717
buf, err := ioutil.ReadFile("/sys/module/apparmor/parameters/enabled")
1818
return err == nil && len(buf) > 1 && buf[0] == 'Y'
1919
}

0 commit comments

Comments
 (0)