Need help: Sync gateway can't connect to Couchbase server (docker)

Hello guys, I’m having trouble when follow this guide: Tutorial - OpenID Connect Authentication for Sync Gateway with Keycloak | Couchbase Developer Portal

My sync gateway is not able to connect to Couchbase server.

2025-04-30T09:48:58.506Z [INF] Config: Couldn't initialize cluster agent: check server ports and cluster encryption setting: dial tcp 172.18.0.3:11210: connect: connection refused - will retry...

Here’s the docker commands that I ran:

  1. Keycloak
docker run -p 8080:8080 --name keycloak --network workshop2 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=password quay.io/keycloak/keycloak:26.2.1 start-dev
  1. Couchbase server
docker run -d --name cb-server --network workshop2 -p 8091-8094:8091-8094 -p 11210:11210 couchbase/server-sandbox:7.6.5
  1. Sync gateway
docker run -p 4984-4985:4984-4985 --network workshop2 --name sync-gateway -d -v /root/OpenID_connect_tutorial/resources/SG_bootstrap-sync-gateway-config.json:/etc/sync_gateway/sync_gateway.json couchbase/sync-gateway:3.2.4-enterprise -adminInterface :4985 /etc/sync_gateway/sync_gateway.json

The gateway config: OpenID_connect_tutorial/resources/SG_bootstrap-sync-gateway-config.json at master · couchbaselabs/OpenID_connect_tutorial · GitHub

Thanks for helping!

This is a docker connectivity problem from the sync gateway container to the couchbase server problem. Sync Gateway can not access the URL couchbase://cb-server which is cb-server:11207.

I didn’t have a problem running only:

$ docker network create -d bridge workshop2
$ docker run -d --name cb-server --network workshop2 -p 8091-8094:8091-8094 -p 11210:11210 couchbase/server-sandbox:7.6.5
// created the SG_account on Couchbase Server
docker run -p 4984-4985:4984-4985 --network workshop2 --name sync-gateway -v ${PWD}/SG_bootstrap-sync-gateway-config.json:/etc/sync_gateway/sync_gateway.json couchbase/sync-gateway:3.2.4-enterprise -adminInterface :4985 /etc/sync_gateway/sync_gateway.json

I did not edit the configuration file at all from what was downloaded.

I tried this on Mac OS and Linux, but I don’t know if there would be something different in your environment.

Note: I literally did not run any of the other instructions including ones that could be suspect to me:

  1. edit /etc/hosts
  2. docker run -p 4984-4985:4984-4985 --network workshop2 --name sync-gateway -d -v pwd/SG_sync-gateway-config-french-cuisine.json:/etc/sync_gateway/sync_gateway.json couchbase/sync-gateway:2.7.2-enterprise -adminInterface :4985 /etc/sync_gateway/sync_gateway.json

The config file for SG_bootstrap-sync-gateway-config.json is correct for Sync Gateway 3.2.4, but the file for SG_sync-gateway-config-french-cuisine.json needs to be updated for Sync Gateway 3.0+

The next steps for investigating would be to look at the docker networking between your network bridge to see if 172.18.0.3 is routable from the Sync Gateway container.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.