I have a java application (jar file) that I want to be able to run from a docker image.
I have created a Dockerfile to create an image using centos as base and install java as such:
Dockerfile FROM centos RUN yum install -y java-1.7.0-openjdk
I ran docker build -t me/java7 after to obtain the image me/java7
however I am stuck at some dead ends.
- How do I copy the jar file from the host into the image/container
- I require 2 Parameters. 1 is a file, which needs to be copied into a directory into the container at runtime. The other is a number which needs to be passed to the jar file in the
java -jarcommand automatically when the user runs
docker runwith the parameters
The jar file is a local file. Not hosted anywhere accessible via wget or anything. The closest I have at the moment is a windows share containing it. I could also access the source from a git repository but that would involve compiling everything and installing maven and git on the image so I’d rather avoid that.
This is what I would desire to arrive at:
docker pull my/image
// image with jar file is downloaded
docker run my/image 1234 /path/to/file
// file is copied
// jar file is executed
any help is much appreciated.