-
搜索mysql镜像
docker search mysql
-
拉取mysql镜像
docker pull mysql:5.7
-
创建容器,设置端口映射、目录映射
mkdir ~/mysql cd ~/mysql
docker run -id \ -p 3306:3306 \ --name my_mysql \ -v $PWD/conf:/etc/mysql/conf.d \ -v $PWD/logs:/logs \ -v $PWD/data:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=123456 \ mysql:5.7
-
操作容器中的mysql
docker exec -it my_mysql /bin/bash
标签:logs,部署,PWD,conf,mysql,3306,docker
From: https://www.cnblogs.com/ryanzhou/p/17153256.html