Rocking it with Docker and Metaparticle

My friend Asad messaged me from the ongoing KubeCon 2017 that a keynote slide from Brendan Burns (one of the creators of Kubernetes) advocated that configuring your app for the cloud native world ought to become significantly simpler. That appealed to me instantly, since I too was wishing a few days ago that Docker and Kubernetes would work seamlessly from my language of choice (which is usually Java) — and preferably, in tandem with my IDE of choice (which is of late IntelliJ); and all this without having to learn arcane commands and dealing with a bunch of YAML files 🙂

So I took Burns’ new Metaparticle library for a spin in the evening, and am glad to report that I went from “Never tried Docker” to using it successfully from a Java program, all in the space of a few hours! I haven’t had success getting its Kubernetes executor to work yet, but hopefully that won’t be too big a hurdle to jump over.

In short, this is what I did, on my Ubuntu 17.04 VM:

  • Installed docker (just ran the commands in this Gist)
  • Cloned the metaparticle-java repository and did a mvn clean install of the same
  • Created a new account on the website, and created a repository called “test” within my account
  • Cloned the metaparticle-package repository, with an eye on running this Java web example class therein
  • Commented out the “executor” property of the Runtime annotation (it defaults to “docker”)
  • Changed the “repository” property of the Package annotation to
  • Compiled the code in metaparticle-package/java directory with mvn clean install
  • Logged into docker using sudo docker login (so that the docker push commands that would be executed by the example program work fine)
  • Downloaded the linux-amd64 version of mp-compiler and added it to the $PATH environment variable
  • Then I ran the example, again through Maven:
    mvn exec:java -Dexec.mainClass=io.metaparticle.examples.web.Main

And that was it! Browsing to http://localhost:8080 showed me this text:

Hello containers [/] from e6ddee21ff84

And I can verify that the app is indeed running within docker:

pramod@deepwork:~$ docker ps -a
e6ddee21ff84 pramodbiligiri/test “/bin/sh -c ‘java …” 14 seconds ago Up 13 seconds>8080/tcp web

It is nice to see more focus on developer experience. I feel that unless you are in the business of making applications run on the cloud, you should avoid burdening developers with having to learn the machinery that is used to make that happen.

Leave a Reply

Your email address will not be published. Required fields are marked *