How it works...

In building microservices in a distributed environment, Docker images are used to implement a totally loosely-coupled design where each application is hosted in one image and can only interact with the others through REST calls and other message-based inter-process communication.

Deploying Spring Boot applications as Docker images does not require any new Maven dependencies to be added or new @Configuration components to be injected, as shown by the recipe. It only takes some changes in the pom.xml and the creation of the Dockerfile which is one of the challenges in implementing this recipe. The following information of the Dockerfile must be seriously considered before building the image:

  • FROM: the image to be created must enable Java 1.8 and above
  • MAINTAINER: identification of the image owner
  • COPY/ADD: command to copy JAR file to the image
  • EXPOSE: the port of the application similar to server port declared in application.properties; the port to be used by the image once the image boots up
  • ENTRYPOINT/CMD: the command in JSON format that will be executed by Docker to boot up the image
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.202.209