How do I run a shell script and jar application in a docker image?
How do I run a shell script(not a oneliner rather say 20-30 lines) and jar application in a docker image at the Entrypoint? Looks like I can specify only one EntryPoint?
One Solution collect form web for “How do I run a shell script and jar application in a docker image?”
The best approach is to add the folder that contains your shell-script and jar application to the Dockerfile.
Suppose you have your shellscript and jar application in a folder app along side Dockerfile. Your directory structure would look something like
Add the folder
app to the Dockerfile
From ubuntu:15.04 # choose right image here add java and other dependencies
ADD app /app
CMD /app/shell-script.sh && java -jar /app/myapplication.jar
Build the image and run
docker run -it imageName.
During development, avoid building the docker image everytime you change your script or jar application by mounting the folder at the same place you placed your folder in the Dockerfile and run the container. This will save you a lot of time.
docker run -it -v $(pwd)/app:/app imageName