docker-compose编排方式安装redis 主从复制与哨兵机制
[root@localhost ]#mkdir -p /usr/local/docker-compose-redis-sentinel
将准备文件全部上传到docker-compose-redis-sentinel目录下
[root@localhost ]#cd /usr/local/docker-compose-redis-sentinel
[root@localhost docker-compose-redis-sentinel]#ll
[root@localhost docker-compose-redis-sentinel]# docker network create --driver=bridge --subnet=172.168.0.0/16 redis-test
[root@localhost docker-compose-redis-sentinel]# docker network ls
#在dockerfile目录 执行下面代码,注意后面上下文点号,执行创建镜像; 创建完成后可以docker images查看生成的镜像 [root@localhost docker-compose-redis-sentinel]# docker build -t redis .
查看构建编排文件的版本
[root@localhost docker-compose-redis-sentinel]# docker-compose version
[root@localhost docker-compose-redis-sentinel]# docker-compose up -d
[root@localhost docker-compose-redis-sentinel]# docker ps -a
docker-compose start
docker-compose stop
[root@localhost docker-compose-redis-sentinel]# docker-compose ps