Docker Compose 数据库服务
配置文件
docker-compose.yaml
文件内容如下:
version: "3.8" services: redis: image: redis:alpine container_name: redis hostname: redis restart: always ports: - 6379:6379 volumes: - redis-data:/data - /etc/localtime:/etc/localtime:ro environment: # - REDIS_PASS=mypassword - REDIS_REPLICATION_MODE=master - REDIS_APPENDONLY=yes - REDIS_APPENDFSYNC=always redis-exporter: image: oliver006/redis_exporter:v1.45.0 container_name: redis-exporter hostname: redis-exporter restart: always ports: - 9121:9121 environment: - REDIS_ADDR=redis://redis:6379 volumes: redis-data: