docker-compose容器化构建redis
redis 的yml 文件
cat redis.yml
version: '3.2'
services:
redis:
image: redis:5.0.5
container_name: redis
restart: always
command: ["redis-server", "--appendonly", "yes", "--requirepass","复杂密码"]
ports:
- 6379:6379
volumes:
- /data/redis_data:/data
准备挂载目录
mkdir /data/redis_data
启动redis
docker-compose -f redis.yml up -d