docker build with a template Dockerfile

I am using travis to build artefacts (jars and zips) and store them on bintray. I want to build docker images that install these artefacts for example for the ‘app’ artefact at version 0.1.0, hash abc123:

FROM some-registry/oracle-jre7
RUN wget -O /opt/app.jar
CMD ["java", "-jar", "/opt/app.jar"]

Every time I want to create this docker image the hash (and maybe the version) will be different and I don’t want to use ‘latest’. I can easily generate the Dockerfile using a template in travis, but I’m not sure how to build the docker image. It seems I can’t build it on travis and and docker hub don’t have an api that I can post a Dockerfile or archive to (although you can do this through the ui on

  • Distcc in docker causing memory leaks
  • kafka-node LeaderNotAvailable errors on send
  • resolve internal DNS in linked docker containers
  • Explanation of this docker file?
  • Docker Experimental FeaturesToolbox
  • ActiveAdmin uninitialized constant in Ruby on Rails
  • I don’t want to get travis to commit the Dockerfile to a secondary git repo because that’s getting really complex to sync the two repos if they have multiple branches. I could also commit a Dockerfile like this to the main repo and then trigger or dockerhub to build after the artefact was created (if they could somehow evaluate the git hash):

    FROM some-registry/oracle-jre7
    ENV APP_GIT_HASH $(git rev-parse --short HEAD) # this definitely doesn't work
    RUN wget${APP_VERSION}_${GIT_HASH}.jar -O /opt/app.jar
    EXPOSE 9000
    CMD ["java", "-jar", "/opt/app.jar"]

    I am currently experimenting with putting a docker host in ec2 and getting travis to get it to build the docker image and push it to a docker repository on bintary, but I’d rather not have to manage the host myself.

  • Wildfly inside docker with externalized configuration
  • Simple Shell Script: Dead Docker Containers
  • Acceptance testing, docker and selenium
  • Redirecting Apache Logs to STDOUT
  • Why does wildcard for jar execution not work in docker CMD?
  • How does Docker Swarm start a container
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.