Helo,
I have a java .jar file that takes a bunch of arguments as input when i run it from the terminal.I want to make a docker image and run it that contains the jar file where i can still pass the arguments for the jar file.
You can use the ARG command inside a Dockerfile to define the name of a parameter and its default value. This default value can also be overridden using a simple option with the Docker build command.
The ARG directive in Dockerfile defines the parameter name and defines its default value. This default value can be overridden by the --build-arg <parameter name>=<value> in the build command docker build .
Installing Standards jar for Docker version 17. xx Navigate to the /ibm/b2bi/install/bin directory. Install the jar using InstallService. Run the following commands to apply configuration changes and to deploy the Standards jar. Run the exit command for the Docker container.
Set the jar file as your entrypoint and the args as your command
An example:
ENTRYPOINT ["/path/to/my/java.jar"]
CMD ["my", "default", "args"]
You can then override the args whenever you run the container, using:
docker run <my-docker-image> some custom args
More information here: http://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With