Can't connect to couchbase server running in a docker container with sync gateway

I’m trying to deploy couchbase server (CE) in a docker container, and everything is working fine (I can access to the console through port 8091), except that I can’t connect an instance of sync gateway (running on a separate aws instance) to the server running in that container. When I try to connect the same sync gateway instance to a couchbase instance running on the same server, but not in a docker container it works fine

Sync gateway appears to be unable to connect to port 8092 when couchbase is in the container. This is the error I’m getting when trying to connect:

_time=2017-06-28T13:00:14.445+00:00 _level=INFO _msg= Trying with selected node 0
2017-06-28T13:00:14.446Z WARNING: Error installing Couchbase design doc: Put http://172.17.0.2:8092/mybucket/_design/sync_gateway: dial tcp 172.17.0.2:8092: getsockopt: connection refused -- db.installViews.func1() at database.go:609
2017-06-28T13:00:14.446Z Debug: RetryLoop retrying Attempt to install Couchbase design doc bucket : sync_gateway after 10 ms.

And here are the commands I’m using to install couchbase server and sync gateway respectively:

docker run -d --name cb -p 8091-8094:8091-8094 -p 11210:11210 couchbase/server:community-4.5.1

docker run --name sg -p 4984:4984 -v /tmp:/tmp/config -d couchbase/sync-gateway /tmp/config/sg-config.json

Here’s my sync gateway file:

{
  "log": ["*"],
  "databases": {
    "db": {
      "server": "http://couchbase-url:8091",
      "bucket":"mybucket",
      "password" : "my-password",
      "sync": `
        function(doc){
        channel(doc.channels);
      }`,
      "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }
    }
  }
}

I’m sure that my security settings allow access to port 8092 on the server, but can’t figure why the same port would be blocked in a docker container given that I specify access to it.

Thanks!

Hi @sam.wilks92,

Can you reproduce this problem locally? Or is only when using AWS? I’m just trying to narrow down if this is a docker issue, an AWS issue, a Couchbase Server issue, or a Sync Gateway issue.