Some of the pits in Docker under the Centos7

Source: Internet
Author: User
Tags docker run

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""   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:

    1. Add--privileged=true to the container with specific permissions in Docker run
    2. Turn off SELinux
    3. 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, 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

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: 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.