I am trying to deploy a SpringMVC application within a Docker container on top to tomcat8.
My problem is This SpringMVC application receive parameters using following code
String username = System.getProperty("db.username");
String password = System.getProperty("db.password");
I am running Docker container with the following command
docker run -e "db.username=root" -e "db.password=123" -v /home/ubuntu/code:/usr/local/tomcat/webapps -i -t -p 80:8080 tomcat
It starts the tomcat conatiner and try to deploy the application, but it does not work and throw application specifc errors username is empty and password is empty.
System.getProperty
is not able to receive the passed environment varaibles
.
Important: Please note I cannot change the code, I can only modify the docker related things.
I think there should be a way to transform passed environment variables into Java property (in order for System.getProperties to work)