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.

  • Copy all files with given extension from docker container
  • Neither “docker stop”, “docker kill” nor “docker -f rm” works
  • application(JMX) monitoring running inside kubernetes cluster using prometheus
  • Docker 'killing' my program
  • Php on docker : Using setLocale
  • Which is the best way to pass AWS credentials to Docker container?
  • 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.

  • Lowercase images names in docker
  • How can I install python modules in a docker image?
  • Failed to connect to containerd
  • use docker containers to simulate one network on different machine
  • How can I see a dynamically assigned port from within a docker container?
  • WSO2 Governance Registry, Docker and boot2docker
  • 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/Test.java
    

    Assuming you have a folder java_proj in your current directory with the file Test.java, 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.