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?

  • Dockerfile and dev/test/prod environment
  • Is the Openshift Origin Docker image production ready?
  • Verfiy the version of ubuntu running in a Docker container
  • Supporting docker based and non docker based deployments
  • Checpoint/restore feature not working in Docker
  • Docker - Application source code updates
  • Start DB2 server in docker container on a specific date without changing host date
  • ElasticSearch PORT 9300 connection refused
  • Kubernetes & insecure docker registries
  • How create MongoDB cluster on Kubernetes?
  • Redirect traffic from docker container into localhost
  • How to connect to mysql running in container from host machine
  • 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

    $ ls
    – myapplication.jar

    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/ && 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

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.