I have a .NET API app and Couchbase Database. Couchbase Database is running as docker container and with one host multinode configuration. My dotnet app is outside the docker environment and external client of Couchbase Docker Container. Docker-compose configuration is below and I can access web consoles of Couchbase with URLs http://localhost:8091 and http://localhost:8094. I tried to connect from .net app with connection strings couchbase://localhost, couchbase://localhost:8091,localhost:8094, couchbase://172.20.0.2,172.20.0.3, couchbase://172.20.0.2:8094,172.20.0.3:8091, couchbase://192.168.65.0 (Docker Host Default IP Address) etc. but cannot connect. But when I configure Couchbase as single node on single host, I can connect from .net app. It looks like some network configuration is missing, I published ports as mentioned below but nothing changed. Anyone who helps me, I will be appreciated.
version: "3.0"
services:
couchbase-node1:
image: couchbase/server:community-7.6.1
container_name: couchbase-node1-container
ports:
- "8091:8091" # Couchbase Web Console
- "8092:8092" # Couchbase Query Service
- "8093:8093" # Couchbase Index Service
- "11210:11210" # Couchbase Data Service
environment:
- CLUSTER_INIT_USERNAME=Administrator
- CLUSTER_INIT_PASSWORD=couchbase2024*
- SERVICES=data,index,query,fts
- USERNAME=Administrator # Couchbase Server Default Username, custom usernames is not accepted!
- PASSWORD=couchbase2024*
networks:
couchbase-net:
ipv4_address: 172.20.0.3
aliases:
- couchbase-node1
volumes:
- node1_data:/opt/couchbase/var
couchbase-node2:
image: couchbase/server:community-7.6.1
container_name: couchbase-node2-container
ports:
– “8094:8091” # Couchbase Web Console
– “8095:8092” # Couchbase Query Service
– “8096:8093” # Couchbase Index Service
– “11211:11210” # Couchbase Data Service
environment:
– CLUSTER_JOIN=couchbase-node1
– USERNAME=Administrator
– PASSWORD=couchbase2024*
networks:
couchbase-net:
ipv4_address: 172.20.0.2
aliases:
– couchbase-node2
volumes:
– node2_data:/opt/couchbase/var
depends_on:
– couchbase-node1
volumes:
local_pgdata:
pgadmin-data:
es-data:
node1_data:
node2_data:
networks:
es-net:
driver: bridge
couchbase-net:
driver: bridge
ipam:
driver: default
config:
– subnet: 172.20.0.0/24