version: "3.9"
services:
debug-busybox:
image: busybox
command: sleep 3600
networks:
- sample-app
redis-node-1:
image: redis:7.2
container_name: redis-node-1
volumes:
- ./redis-data/node1/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "26379:6379"
- "17000:16379"
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
- sample-app
extra_hosts:
- "host.docker.internal:host-gateway"
redis-node-2:
image: redis:7.2
container_name: redis-node-2
volumes:
- ./redis-data/node2/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "26380:6379"
- "17001:16379"
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
- sample-app
extra_hosts:
- "host.docker.internal:host-gateway"
redis-node-3:
image: redis:7.2
container_name: redis-node-3
volumes:
- ./redis-data/node3/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "26381:6379"
- "17002:16379"
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
- sample-app
extra_hosts:
- "host.docker.internal:host-gateway"
redis-node-4:
image: redis:7.2
container_name: redis-node-4
volumes:
- ./redis-data/node4/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "26382:6379"
- "17003:16379"
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
- sample-app
extra_hosts:
- "host.docker.internal:host-gateway"
redis-node-5:
image: redis:7.2
container_name: redis-node-5
volumes:
- ./redis-data/node5/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "26383:6379"
- "17004:16379"
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
- sample-app
extra_hosts:
- "host.docker.internal:host-gateway"
redis-node-6:
image: redis:7.2
container_name: redis-node-6
volumes:
- ./redis-data/node6/redis.conf:/usr/local/etc/redis/redis.conf
ports:
- "26384:6379"
- "17005:16379"
command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
networks:
- sample-app
extra_hosts:
- "host.docker.internal:host-gateway"
redis-cluster-init:
image: redis:7.2
container_name: redis-cluster-init
depends_on:
- redis-node-1
- redis-node-2
- redis-node-3
- redis-node-4
- redis-node-5
- redis-node-6
entrypoint: [ "bash", "-c" ]
command:
- >
sleep 5 &&
echo yes | redis-cli -a secret --cluster create
host.docker.internal:26379
host.docker.internal:26380
host.docker.internal:26381
host.docker.internal:26382
host.docker.internal:26383
host.docker.internal:26384
--cluster-replicas 1
networks:
- sample-app
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
sample-app:
driver: bridge