version: '3.8'
services:
mysql:
image: mysql:latest
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=true
ports:
- '3307:3306'
postgres:
image: postgres:latest
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
ports:
- '5433:5432'
mongos:
image: mongo:latest
ports:
- '27018:27017'
mongo1:
image: mongo:latest
command: ["--replSet", "rs0", "--bind_ip_all", "--port", "27020"]
ports:
- 27020:27020
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'host.docker.internal:27020',priority:1}]}) }" | mongosh --port 27020 --quiet
interval: 5s
timeout: 30s
start_period: 0s
retries: 30
volumes:
- "mongo1_data:/data/db"
- "mongo1_config:/data/configdb"
mongo2:
image: mongo:latest
command: ["--replSet", "rs1", "--bind_ip_all", "--port", "27018"]
ports:
- 27021:27021
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- "mongo2_data:/data/db"
- "mongo2_config:/data/configdb"
mongo3:
image: mongo:latest
command: ["--replSet", "rs1", "--bind_ip_all", "--port", "27019"]
ports:
- 27022:27022
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- "mongo3_data:/data/db"
- "mongo3_config:/data/configdb"
volumes:
mongo1_data:
mongo2_data:
mongo3_data:
mongo1_config:
mongo2_config:
mongo3_config: