docker-compose使用redis
version: '3'
services:
redis:
image: redis:6
container_name: redis1
restart: always
ports:
- 6379:6379
environment:
TZ: Asia/Shanghai
LANG: en_US.UTF-8
volumes:
- ./data:/data
- ./config/redis.conf:/etc/redis.conf
entrypoint: redis-server /etc/redis.conf
redis.conf文件在redis网站下载并修改,也可以不使用配置文件,用redis默认的配置
bing 127.0.0.1 改为 bind 0.0.0.0
appendonly no 改为 appendonly yes