O'Reilly logo

Mastering Spring Cloud by Piotr Minkowski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running containerized microservices

Assuming we have prepared a valid Dockerfile for each service, the next step is to build the whole Maven project with the mvn clean install command, before building a Docker image for every service.  

When building a Docker image, you should always be in the root directory of every microservice source code. The first container that has to be run in our microservices-based system is a discovery server. Its Docker image has been named piomin/discovery-service. Before running Docker's build command, go to the module discovery-service. This Dockerfile is a little simpler than other microservices, because there is no environment variables to set inside the container, shown as follows:

FROM openjdk:8u151-jdk-slim-stretch ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required