vagrant: https://www.vagrantup.com/ 下载Vagrant 2.2.6
virtualbox; https://www.virtualbox.org/wiki/Download_Old_Builds_5_2 下载5.2.4
vagrant 命令行:初始化 vagrant init centos/7(会生成Vagrantfile文件) 下载运行镜像:vagrant up |reload |stop|ssh 编辑网络:Vagrantfile
docker:https://docs.docker.com/engine/install/centos/ 1、sudo yum install -y yum-utils 2、
sudo yum-config-manager
--add-repo
https://download.docker.com/linux/centos/docker-ce.repo 3、
sudo yum install docker-ce docker-ce-cli containerd.io
docker启动:systemctl start docker
docker 阿里云镜像配置:
mkdir /etc/docker
vim /etc/docker/daemon.json # 添加如下内容,具体地址自己申请咯 { "registry-mirrors": ["https://****.mirror.aliyuncs.com"] } # 重启服务 systemctl daemon-reload systemctl restart docker
docker run -d 后台运行 -v 目录映射默认会创建这些没有的目录和文件(本地目录或文件:容器里的目录或文件)
docker mysql安装:docker pull mysql:5.7 docker run -p 3306:3306 --name mysql -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/lib/mysql -v /mydata/mysql/conf:/etc/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
进入docker mysql容器:docker exec -it mysql /bin/bash
docker redis安装:docker pull redis docker run -p 6379:6379 --name redis -v /mydata/redis/data:/data -v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf -d redis redis-server /etc/redis/redis.conf
docker exec -it redis redis-cli