By default, the port of which the block managers listen to is random. To set it to the desired port, you can do the following:
val sc = new SparkContext(new SparkConf())
./bin/spark-submit <all your existing options> --spark.blockManager.port= <port number>