Docker Community Forums

Share and learn in the Docker community.

How to pass variables in resources.properties of java Web application in docker (tomcat)

I am having a project to transform to docker container. I have learnt docker basics and working on advance concepts in parallel. I want expert suggestions for use case using docker.

My java application have a resources.properties file which look like this on /apache-tomcat-8.0.46/webapps/MyAPP/WEB-INF/classes

ElasticClusterName=elasticSearch
ElasticHost=192.168.1.19
ElasticPort=7676
SuperUser=sandeep
esSQLURL=http://192.168.1.19:7677/_sql?sql=
resultsize=1024
refDataSourceJndi=mydb
leaDataSourceJndi=mydb

now I want to avoid using the hardcoded IP and port variables for URL’s . what should I do to create a docker which can be allotted IP address while we RUN the docker instead.

My docker file at simplest looks like this.

FROM tomcat:8.0-alpine
ADD MyAPP.war /usr/local/tomcat/webapps/
EXPOSE 8080
CMD ["catalina.sh", "run"]     

Any help will be appreciated…