Maven build, test and run on a docker machine

It’s probably too soon to ask this question but I hope someone has already had the same problem as me.

I have to build a jar that run on a centos7, openjdk-7 machine.

  • How to run Alfresco Bundled Installer on Docker?
  • Using the Docker REST API to run a container with parameters
  • docker api, attaching container returns extra characters
  • Does docker machine have the overhead of executing docker on top of a virtual machine?
  • Use Prometheus “target relabeling” to extract cAdvisor's Docker image name without tag
  • Version increment for docker images
  • I created a docker machine in a ridiculously short time 🙂 but my issue is more a maven one.

    My questions is :

    How to generate a jar on remote machine (container powered by kitematic on mac for example :p) with the jdk and environment of this machine ?

    Any help we’ll be welcome.

    — EDIT

    I develop on my mac and I would like to launch the build on a “remote” machine which is, in local, my docker container on the kitematic vm.

  • Running an Oracle XE Docker image on a Redhat Host
  • I need to run my node app using this Docker file
  • Docker MySQL: create new user
  • Why do I get an authorization error from Docker when I'm trying to pull a public image?
  • Install package png on Rstudio on Docker,but failed
  • What is mean a valid name as a DNS name component?
  • One Solution collect form web for “Maven build, test and run on a docker machine”

    I think you’re just asking how to compile source on your local Mac using a container. If you have boot2docker installed, the following works:

    $ docker run -v $(pwd)/java_proj:/java_proj java:openjdk-7u65-jdk javac /java_proj/

    Assuming you have a folder java_proj in your current directory with the file, this will compile the test file and should place the output in the same folder. We can do this as the boot2docker VM shares your home directory and we can then mount the folder as a volume inside the container. The code will be compiled using the compiler and environment of the java:openjdk-7u65-jdk image.

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