I have created two docker containers, one running MongodDb and one running Java Spring MVC on Tomcat 8. I have successfully linked the containers, but what I cannot understand is how you configure the java web app in one container to talk to mongodb in the other app.
Where do the connection string settings have to be setup in the java web app?
my Java Spring MVC app has the following applicationContext.xml
settings
<mongo:mongo id="mongo" host="127.0.0.1" port="27017" />
<mongo:db-factory dbname="segmentation" />
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>
<mongo:repositories base-package="com.qantas.repository" />
when i run env in my web container I get
CON1MDB_PORT_27017_TCP_ADDR=172.17.0.10
CON1MDB_PORT_27017_TCP=tcp://172.17.0.10:27017
my DB container is running and has data that I can access from within the terminal and my web app is up and running. I just can't connect to the db from the web app.
Any help would be much appreciated