How to do it...

  1. The first step will be to create an account on Docker Hub so that we can publish our images. Go to https://hub.docker.com and create an account. You can also use your GitHub account and log in using it if you have one.
  2. Once you have an account, we will need to create a repository named springbootcookbook.
  3. With this account created, now is the time to build the image. For this, we will use one of the Gradle Docker plugins. We will start by changing build.gradle to modify the buildscript block with the following change:
buildscript { 
  dependencies { 
    classpath("org.springframework.boot:spring-boot-gradle- 
      plugin:${springBootVersion}") 
    classpath("se.transmode.gradle:gradle-docker:1.2") 
  } 
} 
  1. We will also need to apply this plugin ...

Get Developing Java Applications with Spring and Spring Boot 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.