0

I have a container that I need to connect to a Cassandra instance that is not running in a container. Moreover, the container is running with the Docker bridge network mode as I need to isolate the container network. I have obtained the docker network IP as instructed here. Then I have taken that IP and applied it to the cassandra.yaml config file as instructed here. However, I am still getting an error from the container that it cannot connect to the Cassandra instance. Looks like this is possible for MqSql as mentioned here. Is it possible to achieve this? If so, any pointers on what is wrong?

dhughes
  • 455
  • 1
  • 5
  • 18

1 Answers1

0

It's definitely possible, yes. I believe adjusting the cassandra.yaml to use the Docker network IP is not what you want. I think you simply want Cassandra to bind to a port on the host's network, like it probably would normally. Then, within your container, point your client that's looking to connect to Cassandra to your host's IP address (Note, not localhost, 127.0.0.1).

Within the container, there should be a route (you can check with the route command) that points to a gateway provided by the Docker bridge network. That gateway will route traffic from the Docker bridge network to the host network, which should allow clients within the container to find your Cassandra server.

sfb103
  • 234
  • 7