docker安装redis

新建挂载目录

mkdir -p /var/docker/redis/conf /var/docker/redis/data /var/docker/redis/logs /var/docker/redis/run

执行docker run

docker run -d -p 6379:6379 \
--name redis02 --privileged=true \
-v /var/docker/redis01/redis.conf:/etc/redis/redis.conf \
-v /var/docker/redis01/data:/data \
-v /var/docker/redis01/log:/var/log/redis \
redis:7.2.2 redis-server /etc/redis/redis.conf

在配置文件配置日志目录

chown -R redis:redis /var/log/redis

chmod 600 /var/log/redis/redis-server.log

service redis-server restart

你可能感兴趣的:(Linux,docker,redis,容器)