安装docker
1,安装工具包
sudo yum install -y yum-utils
2,设置远程仓库
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
3,安装
yum list docker-ce --showduplicates | sort -r
可以查看所有仓库中所有docker版本,并选择特定版本安装
sudo yum install docker-ce-18.09.5
安装指定版本的
配置docker镜像加速
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://r6kmf4yy.mirror.aliyuncs.com"]
}
EOF
4,启动
sudo systemctl start docker
5,设置开机启动
systemctl enable docker
安装mysql
1 方法一: docker pull mysql
查找
docker search mysql
拉取
docker pull mysql:5.7
下载完成后,查看本地镜像列表是否包含
docer images | grep mysql
3 创建目录mmysql,用于存放后面的相关东西
mkdir -p /home/mysql/data /home/mysql/logs /home/mysql/conf
4 运行容器
docker run -p 3306:3306 --name mymysql -v /home/mysql/conf:/etc/mysql/ -v /home/mysql/log:/var/log/mysql -v /home/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
–name指定容器名字 -v目录挂载 -p指定端口映射 -e设置mysql参数 -d后台运行
6 进入mysql容器
docker exec -it mymysql bash
7
#登录mysql,用root登录,密码在tty输入
mysql -u root -p
mysql> alter user 'root'@'localhost' IDENTIFIED by '123456..$';
#添加远程登录用户
1,如果因为这个密码 连不上 可以用下边(2)这个账号
mysql> CREATE USER 'zhaozhiguang'@'%' IDENTIFIED WITH mysql_native_password BY '123456..#';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'zhaozhiguang'@'%';
2,
CREATE USER 'zhimakaimen'@'%' IDENTIFIED WITH mysql_native_password BY 'shalijin.1688';
GRANT ALL PRIVILEGES ON *.* TO 'zhimakaimen'@'%';
docker安装redis
docker run -p 6379:6379 \
--name redis -v /home/redis/redis.conf:/etc/redis/redis.conf \
-v /home/redis/data:/data \
-d redis redis-server /etc/redis/redis.conf \
--appendonly yes \
--requirepass "qusu1320"
appendonly :持久化存储
requirepass :登录密码
docker安装rabbitmq
docker run -d --name rabbitmq --publish 5671:5671 \
--publish 5672:5672 --publish 4369:4369 --publish 25672:25672 \
--publish 15671:15671 --publish 15672:15672 \
--hostname warpsoft-rabbit rabbitmq:3-management