Simple sample: Dockerized Java app using a maven plugin

It’s good to be able to build Docker images directly from artifacts (JAR, WAR etc.) produced by Maven builds. One useful tool is the Spotify Docker Maven plugin which can help with this

This example (available on Github)

  • uses Jersey Grizzly connector to build a simple REST app
  • packages this as a (Uber) JAR using Maven
  • the maven build process pushes this as a Docker image (thanks to the plugin)

The pom.xml itself incorporates the Docker related configuration which is generally encapsulated in a Dockerfile (this mode is supported by the plugin as well). Here is a snippet..


Hope this gives you a simple yet useful starting point




About Abhishek

Loves Go, NoSQL DBs and messaging systems
This entry was posted in Docker, Java and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s