Connecting to Couchbase Docker container (go sdk)

Hi all,

I have a docker container for couchbase server 4.6.2 and am using the go-sdk (gocb v1.2.3, go version 1.8.3) for interacting with the database. When I launch the docker container with a 1:1 port mapping from the container to the host, i.e., 8091-8093, 11210 in the container are mapped to 8091-8093, 11210 on the host I have no problems connecting and reading/writing to a given bucket.

However, when I don’t specify the host port mapping and let docker choose some ephemeral ports on the host, I am unable to read/write. I tried using docker port to get the port mapping for 11210 in the container to the host and specify that in the connection string “couchbase://localhost:[port]”, in that case the connect works but my read/write operations time out. I create a bucket named “default” with proxy port 11212 in the container using the rest api, and use this for running my tests. Is there anything else that I need to do for making this work?

Thanks!