table of Contents
Recently
, I encountered a problem when starting the redis container: Before considering the solution, I first checked the reason for this error:
One, the reason for the error
The security module selinux in centos7 banned the permissions. Those who are interested can click on the link to take a look at the selinux security module.
There are three solutions I found below.
Two, the solution
1. Add --privileged=true to docker run to add specific permissions to the container
2. Add rules in selinux and modify the mount directory
Command: chcon [-R] [-t type] [-u user] [-r role] file or directory
Parameters:
-R: all the directories under this directory are also modified at the same time;
-t: the type of the security text followed Fields, such as httpd_sys_content_t;
-u: followed by identification, such as system_u;
-r: followed by roles, such as system_r;
eg:chcon -Rt svirt_sandbox_file_t /root/docker/redis/
3. Close selinux
Modify the configuration file:
vim /etc/sysconfig/selinux
change SELINUX=enforcing to SELINUX=disabled