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?

  • Resolve docker-compose container names from host machine
  • Docker compose port mapping
  • mysql 5.7 can't allow docker IP access on CentOS7
  • Why are container's size and image's size equivalent?
  • Rancher template - Hadoop Illegal character in host-name
  • Use Docker, Gunicorn, Nginx in django development environment but can only see nginx welcome page?
  • Graylog 2.2.0-beta.1 in Docker with UDP input: Unable to load default stream
  • Docker - copy file from container to host
  • How to make docker to stop container when host process attached to tty terminates
  • How to connect to PostgreSQL server that's run on docker
  • Docker - cannot mount volume over existing file, file exists
  • Stopping docker container from inside
  • 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.