1. 下载必要的包
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
2. 指定虚拟机去哪里安装 docker
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3. 安装 docker
sudo yum install docker-ce docker-ce-cli contained.io
4. 启用docker
sudo systemctl enable docker
5. 配置国内镜像
sudo mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
EOF
重启docker后台
systemctl daemon-reload
重启docker服务
systemctl restart docker
6. docker pull mysql:5.7 获取images镜像
7. 启动容器
docker run -p 3306:3306 --name mysql -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/l
ib/mysql -v /mydata/mysql/conf:/etc/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
标签:mydata,安装,sudo,ce,yum,mysql,docker,过程 From: https://www.cnblogs.com/zhulongxu/p/17454339.html