Connecting from host to couchbase container

I have a couchbase container that can be reached from web console (http://localhost:8091)
But trying to connect from an asp core web application from host cause an error.
There was an error attempting to resolve hosts using DNS-SRV - Non-Existent Domain

It looks like you used Docker. When you created the image, which ports did you open? Are you running the ASP.NET application also in Docker? If so, are you using Docker Compose? If not, you might try SDK Doctor to see if there are any network issues - SDK Doctor | Couchbase Docs

Could you also post the code you’re using to connect to the cluster? (Connection string, DI config, etc)

The container run with this command
docker run -d --name db -p 8091-8096:8091-8096 -p 11210-11211:11210-11211 couchbase
I am running asp app in my host not as a container. I tested connection with --network host switch for container and it works. This Issue is a network related problem. because web console working on localhost and only client has connection problem.


Also, the particular DNS-SRV message you posted is a warning, not an error. It’s generally expected in local development. Unless disabled, when connecting via a single domain name (including “localhost”) the SDK will attempt to lookup a DNS SRV record using that domain name. For example, if connecting to “couchbase://my-cluster” it will try to lookup “” as an SRV record, which would then contain a list of all the nodes in the cluster. This is useful for managing your cluster node list via DNS instead of configuration, and is very powerful in Kubernetes using the Couchbase Autonomous Operator.

If this lookup fails, as it would for “couchbase://localhost”, the SDK just warns and falls back to connecting as a plain server name.


Error raise if I don’t run couchbase container with switch --network host

  There was an error attempting to resolve hosts using DNS-SRV - Non-Existent Domain
info: Couchbase.Core.ClusterContext[8000]
  Cannot bootstrap bucket AuthCacheModel as Couchbase.
  System.IO.IOException: The operation is not allowed on non-connected sockets.
     at System.Net.Sockets.NetworkStream..ctor(Socket socket, FileAccess access, Boolean ownsSocket)
     at System.Net.Sockets.NetworkStream..ctor(Socket socket, Boolean ownsSocket)
     at Couchbase.Core.IO.Connections.MultiplexingConnection..ctor(Socket socket, ILogger`1 logger)
     at Couchbase.Core.IO.Connections.ConnectionFactory.CreateAndConnectAsync(IPEndPoint endPoint, CancellationToken cancellationToken)
     at Couchbase.Core.IO.Connections.ConnectionPoolBase.CreateConnectionAsync(CancellationToken cancellationToken)
     at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.<>c__DisplayClass28_0.<<AddConnectionsAsync>g__StartConnection|0>d.MoveNext()
  --- End of stack trace from previous location ---
     at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.AddConnectionsAsync(Int32 count, CancellationToken cancellationToken)
     at Couchbase.Core.IO.Connections.DataFlow.DataFlowConnectionPool.InitializeAsync(CancellationToken cancellationToken)
     at Couchbase.Core.ClusterNode.InitializeAsync()
     at Couchbase.Core.DI.ClusterNodeFactory.CreateAndConnectAsync(HostEndpoint endPoint, BucketType bucketType, NodeAdapter nodeAdapter, CancellationToken cancellationToken)
     at Couchbase.Core.ClusterContext.CreateAndBootStrapBucketAsync(String name, HostEndpoint endpoint, BucketType type)

Asp connection string

"Couchbase": {
    "ConnectionString": "couchbase://localhost",
    "Servers": [ "http://localhost" ], // also tested with http://localhost:8091
    "Username": "username",
    "Password": "password"


@tester -

That error is logged and suppressed intentionally; the code will then try the hosts provided in the connection string to bootstrap directly to the server without using DNS-SRV. You will see it your logs whenever you bootstrap to a server directly.


I tested connection by sdk-doctor. It successfully connectded and prints out all services is up and all ip addresses of docker host and container id is printing out. But error is not gone in asp app.After warning s about bootstrap problem, error shown

 An unhandled exception has occurred while executing the request.
  System.AggregateException: One or more errors occurred. (Bucket with name AuthCacheModel does not exist)
   ---> Couchbase.Management.Buckets.BucketNotFoundException: Bucket with name AuthCacheModel does not exist