MySQL 5.6 Container Use custom profile permissions issue

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.