vyeluri5
vyeluri5

Reputation: 487

App running in container cannot connect to couchbase on VM localhost

Ive a simple webapp running on docker container which makes DB connection to couchbase.

My couchbase is currently running on a VM localhost. (not another container).

I tried issue a command

docker run --net=host -p 8081:8081 {**image-name-one**}  // This connects without issue

Now, I need another instance of the same app but different port and for that I created a bridge network with ip - 192.168.0.1 then modified connection string to use network ip

docker network create -d bridge --subnet 192.168.0.0/24 --gateway 192.168.0.1 test

Now, I tried running 2nd container with below ports

docker run --net=test -p 8083:8081 {**2nd-image-name**}  // This will never connect to the database

Any insight would be greatly helpful.

Upvotes: 1

Views: 170

Answers (1)

vyeluri5
vyeluri5

Reputation: 487

Im using Ubuntu 16.04.

I found a work around by adding the subnet to my firewall to allow connections to any ports.

Now, I can get my services connect to Couchbase.

Upvotes: 1

Related Questions