quantum-fusion / springboot_swagger_example-master-cassandra

0 stars 0 forks source link

Datastax TransportException inside Docker due to port and ipaddress binding conflict. #2

Closed quantum-fusion closed 6 years ago

quantum-fusion commented 6 years ago

The Problem:

Datastax driver, and Docker have a limitation, that is causing a conflict on TransportExceptions from within a Docker container.

A testcase was provided to Google (https://groups.google.com/forum/#!topic/kubernetes-users/XzfuAsiVXLk ) and a question was asked to Datastax (https://datastax-oss.atlassian.net/browse/JAVA)

quantum-fusion commented 6 years ago

Docker Forum: https://forums.docker.com/t/docker-port-binding-conflict-on-cassandra-incoming-port-9042-and-spring-boot-outgoing-port-9042/42759

DataStax Cassandra Java Driver Forum: https://groups.google.com/a/lists.datastax.com/forum/#!topic/java-driver-user/4YpaLbXOcHQ

quantum-fusion commented 6 years ago

runDockerApplication runDockerApplication successfully sets up 2 Docker instances locally

testDockerApplication runDockerApplication successfully sets up 2 Docker instances locally.

quantum-fusion commented 6 years ago

executed tests to run spring boot inside a docker container, and found that pinging the docker containers from either MACOS command line, and from within the springboot docker instance, helped debug the port bindings, and determine locality of scope for ip addresses on a network.

If the ping fails from within the springboot instance running inside docker, it means that the ip address is unaccessible, and a root cause has to be determined.

quantum-fusion commented 6 years ago

I was able to add port listening to Docker invocation. https://forums.docker.com/t/how-to-expose-port-on-running-container/3252

The order that you execute the service startup matters.

To run these apps in Docker the Solution was to do the following.

Startup up the SpringBoot application service first.

Second, then start the Cassandra service second.

quantum-fusion commented 6 years ago

Can not start container, port is already allocated: https://github.com/moby/moby/issues/20486

quantum-fusion commented 6 years ago

Connection refused resources: https://github.com/hhandoko/cassandra-migration/issues/14

quantum-fusion commented 6 years ago

Docker cassandra resources: http://blog.ditullio.fr/2016/06/10/docker-docker-basics-cassandra/