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.

  1. how copy jar file host image/container
  2. i require 2 parameters. 1 file, needs copied directory container @ runtime. other number needs passed jar file in java -jar command automatically when user runs docker 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.

  1. in dockerfile, add local file using add, e g

    add your-local.jar /some-container-location 
  2. 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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -