version: "3.8" services: redis1: image: redis:alpine container_name: redis1 ports: - "26379:6379" command: redis-server /usr/local/etc/redis/redis.conf volumes: - ./redis/redis1.conf:/usr/local/etc/redis/redis.conf networks: redisnet: ipv4_address: 172.23.0.4 redis2: image: redis:alpine container_name: redis2 ports: - "36379:6379" command: redis-server /usr/local/etc/redis/redis.conf volumes: - ./redis/redis2.conf:/usr/local/etc/redis/redis.conf networks: redisnet: ipv4_address: 172.23.0.5 redis3: image: redis:alpine container_name: redis3 ports: - "46379:6379" command: redis-server /usr/local/etc/redis/redis.conf volumes: - ./redis/redis3.conf:/usr/local/etc/redis/redis.conf networks: redisnet: ipv4_address: 172.23.0.6 sentinel1: image: redis:alpine container_name: sentinel1 depends_on: - redis1 ports: - "26380:26379" command: redis-sentinel /usr/local/etc/sentinel/sentinel.conf volumes: - ./sentinel1:/usr/local/etc/sentinel extra_hosts: - "redis1:172.23.0.4" - "redis2:172.23.0.5" - "redis3:172.23.0.6" networks: - redisnet sentinel2: image: redis:alpine container_name: sentinel2 depends_on: - redis1 ports: - "26381:26379" command: redis-sentinel /usr/local/etc/sentinel/sentinel.conf volumes: - ./sentinel2:/usr/local/etc/sentinel extra_hosts: - "redis1:172.23.0.4" - "redis2:172.23.0.5" - "redis3:172.23.0.6" networks: - redisnet sentinel3: image: redis:alpine container_name: sentinel3 depends_on: - redis1 ports: - "26382:26379" command: redis-sentinel /usr/local/etc/sentinel/sentinel.conf volumes: - ./sentinel3:/usr/local/etc/sentinel extra_hosts: - "redis1:172.23.0.4" - "redis2:172.23.0.5" - "redis3:172.23.0.6" networks: - redisnet networks: redisnet: driver: bridge ipam: config: - subnet: 172.23.0.0/16