Connect Java to snufkin/spark-master (or other docker) with ip

Hi,
I’m in trouble using docker and java. I’m using snufkin/spark-master and I tried to use these Java API spark-core. This docker in the future will be connected with a cassandra docker but it’s not relevant at the moment. My question is about the connection to the master. If I don’t want use the localhost as ip, what do I have to use? I did docker inspect container-name and I found the container ip. I tried to use it but nothing happen.

This is an Example code

to explain more my question: What I have to do to connect to a remote docker, or better this one with spark?

thanks