Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e2eb0f

Browse files
committed
--selinux-enabled flag should be ignored on Disabled SELinux systems
On Fedora and RHEL we ship selinux-enabled flag in the docker.service config, but if people setup the /var/lib/docker as btrfs and disable SELinux, we should not block the daemon from running. Docker-DCO-1.1-Signed-off-by: Dan Walsh <[email protected]> (github: rhatdan)
1 parent 3ea5a20 commit 9e2eb0f

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

daemon/daemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
775775
log.Debugf("Using graph driver %s", driver)
776776

777777
// As Docker on btrfs and SELinux are incompatible at present, error on both being enabled
778-
if config.EnableSelinuxSupport && driver.String() == "btrfs" {
778+
if selinuxEnabled() && config.EnableSelinuxSupport && driver.String() == "btrfs" {
779779
return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver!")
780780
}
781781

daemon/utils_linux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ func selinuxSetDisabled() {
1111
func selinuxFreeLxcContexts(label string) {
1212
selinux.FreeLxcContexts(label)
1313
}
14+
15+
func selinuxEnabled() bool {
16+
return selinux.SelinuxEnabled()
17+
}

daemon/utils_nolinux.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ func selinuxSetDisabled() {
77

88
func selinuxFreeLxcContexts(label string) {
99
}
10+
11+
func selinuxEnabled() bool {
12+
return false
13+
}

0 commit comments

Comments
 (0)