Ask questions:
???????? When using Rancher2.0.2 to deploy a MySQL deployment, we will find that if the MySQL container (pod) starts up only when the/var/lib/mysql data directory is set up, when the data directory and configuration directory are simultaneously mounted, The MySQL container (pod) will not start.
Solution Ideas:
???????? We run a MySQL 5.6 container, observe the normal runtime, the container data directory, configuration directory, log directory owner and permissions, and view the container group files, compared to the host group files, should be able to find the reason, You can then resolve the problem by setting the correct directory permissions and owner in the host.
On the Docker host:
Group files:??? /etc/group
root:x:0:
Adm:x:4:syslog,catty
Docker:x:999:catty
catty:x:1000
In the MySQL container:
Function???????????????? Directory?????????????????????????????????????? Chown-r??????? chmod
Log directory:? /var/log/mysql????????????????????? Mysql:adm??????? 640
Data Catalog:? /var/lib/mysql?????????????????????? Mysql:mysql????? 640
Configuration file:? /etc/mysql/mysql.conf.d??? Root:root???????????? 644
Group files:????? /etc/group
root:x:0:
Adm:x:4:
mysql:x:999:
Figure 1, directory permissions and owners in the MySQL5.6 container
Workaround:
???????? If you are running a MySQL container and need to use a custom profile, you can create a directory on the host, set the owner as the root user and the root group, command: Chown-r root:root/etc/mysql/, and then when you run the container, use-v/etc/mysql:/ Etc/mysql mount the directory to the container so that the MySQL container can start normally.
Reference Links :
Set permissions on log folder #349
https://github.com/docker-library/mysql/pull/349
5.7.10-fails to mount Volume '/var/log/mysql ' #146
Https://github.com/docker-library/mysql/issues/146#ref-commit-68a2cd4
MySQL 5.6 Container Use custom profile permissions issue