Data volume mysql mount
Download the mysql5.7 image
docker pull mysql:5.7
Run mirror
//-d 后台运行
//-p 端口映射
//-v 卷挂载
//-e 环境配置
//--name 容器名
docker run -d -p 3310:3306 -v /home/mysql/conf:/etc/mysql/conf.d -v /home/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql01 mysql:5.7
Connect to mysql to
view file mounting
cd /home/mysql
ll
cd data
ll
Create a new database test to
view the host mount
ll
Detection database persistence
After deleting the mysql container, the files mounted by the host will not be deleted