java - How to create docker image for local application taking file and value parameters -
i have java application (jar file) want able run docker image.
i have created dockerfile create image using centos base , install java such:
dockerfile centos run yum install -y java-1.7.0-openjdk
i ran docker build -t me/java7
after obtain image me/java7
however stuck @ dead ends.
- how copy jar file host image/container
- i require 2 parameters. 1 file, needs copied directory container @ runtime. other number needs passed jar file in
java -jar
command automatically when user runsdocker run
parameters
extra notes:
the jar file local file. not hosted anywhere accessible via wget or anything. closest have @ moment windows share containing it. access source git repository involve compiling , installing maven , git on image i'd rather avoid that.
any appreciated.
in dockerfile, add local file using add, e g
add your-local.jar /some-container-location
you use volumes put file in container in runtime, e g
volume /copy-into-this-dir
and run using
docker run -v=/location/of/file/locally:/copy-into-this-dir -t me/java7
you can use entrypoint , cmd pass arguments, e g
entrypoint ["java", "-jar", "/whatever/your.jar"] cmd [""]
and again run using
docker run -v=/location/of/file/locally:/copy-into-this-dir -t me/java7 --mynumber 42
(have @ dockerfile documentation.)
Comments
Post a Comment