Objective
has been trying to build a MySQL mirror based on CentOS, based on an official CentOS image. However, after the creation of the mirror image size has been more than 1.5G, which for the general Docker image is too bloated. The Docker hub is officially provided with a MySQL image only 324MB. For now, I haven't found any good way to reduce the size of the image I made, so I'll use the official bar first!
Docker Pull mysql:5.7
How do I use this docker mirror?
1. Start a MySQL server container (default port 3306)
Docker run--name mysql-e mysql_root_password=root-d mysql:5.7
2, start another container, access to the MySQL server through the link way
Docker run--name Some-app--link mysql:mysql-d application-that-uses-mysql
3, start another container, through the MySQL command line access to the MySQL server
Docker run-it--link mysql:mysql--rm mysql:5.7 sh-c ' exec mysql-h ' $MYSQL _port_3306_tcp_addr '-P ' $MYSQL _port_3306_tcp_p ORT "-uroot-p" $MYSQL _env_mysql_root_password "'
4, access to the server console
Docker exec-it MySQL Bash
5. View MySQL server log
More content, can refer to the official website detailed: https://hub.docker.com/_/mysql/.
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.