Tomcat in docker

I have created some services using jersy framework and deployed it on local tomcat server. from here it is hitting the db which is on azure instance and den i did a build and deployed the war file generated on another azur instance and dockerized it.ie i created a dockerfile installing tomcat and jre required and containerized it.now wen i run this container it hits db the first time i start the container it hits the db but thereafter it says connection closed.