如何在CentOS Docker容器内启用SELinux?


13

我试图将SELinux安装在Docker容器中,以便分发内部使用SELinux的应用程序。

默认的CentOS映像未安装SELinux:

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

从yum安装它之后,尚未启用SELinux。

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

我发现的所有文档都说您需要发出系统重新启动才能进行安装。但是,我不知道一种模拟Docker容器内系统重启的方法。

如何在容器内安装和启用SELinux?

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.