1、创建一个名称为casonet的自定义网络
docker network create --driver bridge --subnet 172.18.0.0/16 --gateway 172.18.0.1 casonet
2、下载redis镜像
docker pull redis
3、创建6个conf文件,脚本快速创建
[root@localhost redisfile]#
#脚本循环六次创建conf文件
#自定义/casocloud/redis目录
for port in $(seq 1 6); \
do \
mkdir -p /casocloud/redis-jiqun/node-${port}/conf
touch /casocloud/redis-jiqun/node-${port}/conf/redis.conf
cat << EOF >/casocloud/redis-jiqun/node-${port}/conf/redis.conf
# Redis configuration file example.
# ./redis-server /path/to/redis.conf
################################## INCLUDES ###################################
# include /path/to/local.conf
# include /path/to/other.conf
################################## MODULES #####################################
# loadmodule /path/to/my_module.so
# loadmodule /path/to/other_module.so
################################## NETWORK #####################################
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1 ::1
bind 0.0.0.0
port 6379
tcp-backlog 511
tcp-keepalive 300
################################# TLS/SSL #####################################
# port 0
# tls-port 6379
# tls-cert-file redis.crt
# tls-key-file redis.key
# tls-dh-params-file redis.dh
# tls-ca-cert-file ca.crt
# tls-ca-cert-dir /etc/ssl/certs
# tls-auth-clients no
# tls-replication yes
# tls-cluster yes
# tls-protocols "TLSv1.2 TLSv1.3"
# tls-ciphers DEFAULT:!MEDIUM
# tls-ciphersuites TLS_CHACHA20_POLY1305_SHA256
# tls-prefer-server-ciphers yes
# tls-session-caching no
# tls-session-cache-size 5000
# tls-session-cache-timeout 60
################################# GENERAL #####################################
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
always-show-logo yes
###########################