Docker create file from template provided and run inside container as a parameter

HI All,

I am new to Docker and started to do automation in that.Here my requirement:

Need to generate file which contains few variable , that need to be passed during run time .
Once got file, use that file to install the application.

For example:
Template File:
http port is %variable1%
java heap size is %variable2% file which need to generate from template should be:
http port is 8080
java heap size is 2049

Finally will run sh %installer%

Request you to help me with Dockerfile only


Is there a reason why you would go with this design? im thinking just passing some ENV when you start the container?

How does your Dockerfile look at this moment?

Hi ,

As the application we are installing using the same thing using Ansible like below:
Created Role with template which would create file.With in playbbok executed sh installer -f

Hence same need to be done using Docker , so went to this design.

Not sure on creating dynamically in run time using docker with ENV.

Regarding current Dockerfile, i am not sure on how to go with. Please suggest

Instead of trying to lift your old patterns into the new world, you should at least try to learn and embrace the typical Docker patterns. A Docker container is not a VM: it is just a set of files that consist of command line tools and libraries that make up the OS, not a single process/service is started unless you start it in your Dockerfile’s ENTRYPOINT or CMD declaration.

What you want is to create a Dockerfile that does a default installation of your application. Then you will want to create an entrypoint that does preperation work (like rendering ENV values into config files) before it finaly starts your main application. People usualy write entrypoint scripts depending on their need in bash - though they could be written in python or whatever commes to mind.

What does your property file affect? Are you using it to render a startscript or a configuration?

Word of advice: Java is not CGROUP aware by default. You need to make sure your JAVA_OPTS leverage the new options that enable CGROUP awareness: