Browse code

--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 <dwalsh@redhat.com> (github: rhatdan)

Dan Walsh authored on 2014/09/23 20:46:02
Showing 3 changed files
... ...
@@ -775,7 +775,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
775 775
 	log.Debugf("Using graph driver %s", driver)
776 776
 
777 777
 	// 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" {
779 779
 		return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver!")
780 780
 	}
781 781
 
... ...
@@ -11,3 +11,7 @@ func selinuxSetDisabled() {
11 11
 func selinuxFreeLxcContexts(label string) {
12 12
 	selinux.FreeLxcContexts(label)
13 13
 }
14
+
15
+func selinuxEnabled() bool {
16
+	return selinux.SelinuxEnabled()
17
+}
... ...
@@ -7,3 +7,7 @@ func selinuxSetDisabled() {
7 7
 
8 8
 func selinuxFreeLxcContexts(label string) {
9 9
 }
10
+
11
+func selinuxEnabled() bool {
12
+	return false
13
+}