--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)
This commit is contained in:
Dan Walsh 2014-09-23 07:46:02 -04:00
parent 3ea5a20776
commit 9e2eb0f1cc
3 changed files with 9 additions and 1 deletions

View file

@ -775,7 +775,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
log.Debugf("Using graph driver %s", driver)
// As Docker on btrfs and SELinux are incompatible at present, error on both being enabled
if config.EnableSelinuxSupport && driver.String() == "btrfs" {
if selinuxEnabled() && config.EnableSelinuxSupport && driver.String() == "btrfs" {
return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver!")
}

View file

@ -11,3 +11,7 @@ func selinuxSetDisabled() {
func selinuxFreeLxcContexts(label string) {
selinux.FreeLxcContexts(label)
}
func selinuxEnabled() bool {
return selinux.SelinuxEnabled()
}

View file

@ -7,3 +7,7 @@ func selinuxSetDisabled() {
func selinuxFreeLxcContexts(label string) {
}
func selinuxEnabled() bool {
return false
}