I am trying to install SELinux inside of a Docker container in order to distribute an application that uses SELinux internally.

The default CentOS image does not have SELinux installed:

$ docker run -it centos:latest /bin/bash
[root@38ae5a98273d /]# sestatus
bash: sestatus: command not found

After I install it from yum, SELinux is not enabled yet.

[root@38ae5a98273d /]# yum install policycoreutils selinux-policy-targeted
[root@38ae5a98273d /]# sestatus
SELinux status:                 disabled

All the documentation I've found says that you need to issue a system reboot in order to install it. However, I am not aware of a method to simulate a system reboot inside a Docker container.

How does one go about installing and enabling SELinux inside of a container?

1 Answer 1


SELinux is not namespaced, so individual containers cannot have their own separate SELinux policies. SELinux will always appear to be "disabled" in a container, though it is running on the host.

If your application requires SELinux, you cannot use it inside Docker. You will need to use a regular virtual machine.

  • 1
    c.f. youtube.com/watch?v=zWGFqMuEHdw Feb 17, 2016 at 2:44
  • 3
    tl; dr:containerisation isn't virtualisation.
    – MadHatter
    Feb 17, 2016 at 6:21
  • Too bad... spent some time to try test Ansible Molecule roles booth in KVM and in the rootless Podman container.
    – Dzintars
    Feb 28, 2021 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.