I first started using Docker mostly for development. It is quite facilitating. Recently ran into a scenario where I needed to compile and package couple of Java projects. With docker I can do just that without having to install JDK and Apache Maven on my machine.
First project uses Maven, so I cloned the source on my machine and ran a docker container using Maven image:
docker run -it --rm -v "$PWD":/usr/src/granite -w /usr/src/granite maven:3.2-jdk-7 mvn clean install
After the command is done the container is removed, and I got a neatly packed WAR package in my output folder.
Similarly for the second project, I needed to make a WAR archieve, so instead of Maven I used Java image:
docker run -it --rm -v "$PWD":/usr/src/radiator -w /usr/src/radiator java:7 jar -cvf radiator.war *
Later I remotely deployed them to a Apache Tomcat server using curl command:
curl --upload-file radiator.war "http://username:password@192.168.1.111:8080/manager/text/deploy?path=/radiator&update=true"
Pretty neat ha!