1.CENTOS7 Security SELinux prohibits some security permissions, causing MySQL and mariadb to be prompted with the following information when they mount/var/lib/mysql:
1[[email protected] mariadb]# Docker run-d-v ~/mariadb/data/:/var/lib/mysql-v ~/mariadb/config/:/etc/mysql/conf.d-e M ysql_root_password='123456'test01/mariadb219c4aa113c610f53f9720ee806e3c918dd18d21dff75c043bdd6db60011a135d3[email protected] mariadb]# DockerPS-a4CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES519c4aa113c61 test01/mariadb"docker-entrypoint.sh" 4Seconds ago Exited (1)1Seconds ago Desperate_kelle
Logs command view, the discovery prompt message is: chown:changing ownership of '/var/lib/mysql/... ': Permission denied
So there are three ways to solve this problem:
- Add--privileged=true to the container with specific permissions in Docker run
- Turn off SELinux
- In selinux add rule, modify mount directory de
2. Sometimes, when launching a container with port mappings, the following prompt appears:
1 iptables failed:iptables--wait0/0192.168. 20.22: 52080! -I docker0:iptables:No chain/target/match by that name
This thing, check to find out also did not give explanations, refer to the next http://www.lxy520.net/2015/09/24/centos-7-docker-qi-dong-bao/, this article said to modify the Iptables file, Just CENTOS7 may not have this file at all, or do not have iptables service, the result is finally restarted host, resumed, during the attempt to use the Firewall-cmd command query, and stop the firewall. This idea is for posterity's reference.
Some of the pits in Docker under the Centos7