//其中password为自定义的密码 my-redis: image: redis:5.0.2-alpine container_name: my-redis environment: - TZ=Asia/Shanghai volumes: - ./redis/data:/my/data command: "redis-server --requirepass mypassword(自定义的密码) --appendonly yes" ports: - 6379:6379 privileged: true restart: always networks: - my_net