Docker file mounting in CentOS7, permission issues in the container

http://www.linuxidc.com/Linux/2015-03/115124.htm

Run the NodeJs container in CentOS7, and found that the mounted local directory does not have execution permission in the container. After various verifications and Google searches, I found The cause of the problem is recorded here. The reason is that the security module selinux in CentOS7 disables the permissions. There are at least the following three ways to solve the problem that the mounted directory has no permissions:

1. When running the container, add privileges to the container:
Example: docker run -i - t --privileged=true -v /home/docs:/src waterchestnut/nodejs:0.12.0

2, temporarily shut down selinux:
Example: su -c "setenforce 0"
and then execute: docker run -i -t -v /home /docs:/src waterchestnut/nodejs:0.12.0
Note: Remember to restart selinux afterwards, command: su -c "setenforce 1"

3, add selinux rules, add the directory to be mounted to the whitelist:
Example: chcon - Execute after Rt svirt_sandbox_file_t /home/docs
: docker run -i -t -v /home/docs:/src waterchestnut/nodejs:0.12.0



Docker permission problem:
1. dial unix /var/run/docker.sock: permission deniedMethodA
: chcon -Rt svirt_sandbox_file_t /home/pandy/docker/tomcat_docker_inst_list/ This folder is hung in the docker container and can execute permissions.
Method B: docker run -d -p 8001:8001 --security-opt label:type: docker_t -v /var/run/docker.sock:/var/run/docker.sock --name dockerboard dockerboard/dockerboard If it hangs in the system folder, then this method may be used, adding parameters: --security- opt label:type:docker_t , what type is this type, and where should I go for reference?

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326996150&siteId=291194637