docker-compose搭建redis服务
1.首先准备所需文件
mkdir data
touch redis.conf
touch docker-compose.yaml
# 这个结构
[root@iZbp16ukkrjo2m3jyyo3tfZ redis]# ls
data docker-compose.yaml redis.conf
2.编辑redis.conf
bind 0.0.0.0
port 6379
# tcp-backlog 511
timeout 0
tcp-keepalive 0
logfile ""
supervised no
3.编辑docker-compose.yaml
version: "3.1"
services:
redis:
image: redis
container_name: redis
restart: always
environment:
TZ: Asia/Shanghai
ports:
- 6379:6379
command: /usr/local/bin/redis-server /usr/local/etc/redis/redis.conf
restart: always
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf:rw
- ./data:/data
4.启动
docker-compose -f docker-compose.yaml up -d
文章来源地址https://www.toymoban.com/news/detail-628506.html
文章来源:https://www.toymoban.com/news/detail-628506.html
到了这里,关于docker-compose搭建redis服务的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!