version: '3'
services:
redis:
image: redis
restart: always
hostname: redis #指定容器hostname
container_name: redis
privileged: true
ports:
- 6379:6379
environment:
TZ: Asia/Shanghai #timeZone 時區(qū)
volumes:
# 在當前目錄下創(chuàng)建/data /conf /logs
- ./data:/data
- ./conf:/etc/redis/redis.conf
- ./logs:/logs
command: [ "redis-server", "/etc/redis/redis.conf" ]
在當前目錄(/compose/redis/)下創(chuàng)建data,conf,logs目錄,用作數(shù)據(jù)卷映射
下載redis的配置文件,放到conf目錄下
http://download.redis.io/redis-stable/redis.conf
docker-compose up -d