Chapter 2. Containerizing Microservices with Docker

In this chapter, we will focus more on how to package and ship our microservice. We will learn the following recipes:

  • Building an executable JAR using the Maven Shade plugin
  • Building an executable JAR using the Spring Boot Maven plugin
  • Installing and setting up Docker
  • Writing your Dockerfile
  • Building your Docker image
  • Running your microservice inside a Docker container
  • Pushing your image to Docker Hub

Building an executable JAR using Maven Shade plugin

Before we jump into this recipe, let's talk about why we are doing this. Our goal is to construct a shippable artifact that can be executed from any platform or machine. In order to do that, we have to make sure our final artifact has all dependencies packaged ...

Get Microservices Deployment Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.