配置redis挂载

时间:2024-01-23 15:47:54

1. 暂停和删除redis

2.创建文件夹

/usr/local/software/redis/6379/conf/

/usr/local/software/redis/6379/data/

把redis-conf文件上传到conf文件夹中

3.配置网络

docker network create --driver bridge --subnet=172.18.12.0/16 --gateway=172.18.1.1 wn_docker_net

4.运行

docker run -it \
--name redis_6379 \
--privileged \
-p 6379:6379 \
--network wn_docker_net \
--ip 172.18.12.10 \
--sysctl net.core.somaxconn=1024 \
-e TIME_ZONE="Asia/Shanghai" -e TZ="Asia/Shanghai" \
-v /usr/local/software/redis/6379/conf/redis.conf:/usr/local/etc/redis/redis.conf \
-v /usr/local/software/redis/6379/data/:/data \
-d redis \
/usr/local/etc/redis/redis.conf