3.4 Running the Lab

Building the docker image for the order microservice and start the environment.

In the previous section we implemented the microservice. Lets build and run it.

Building

The order microservice provides a multistage Dockerfile for building the java application and creating a docker container.

Task 3.4.1 - Build docker container

Build the container using the following details:

  • Dockerfile: rest-order/src/main/docker/Dockerfile.multistage.jvm
  • Tag: microservices-lab-rest-order:latest
Task Hint

Change to base directory of this lab and run docker build.

1
2
cd <PROJECT_ROOT>/code/rest
docker build -f rest-order/src/main/docker/Dockerfile.multistage.jvm -t microservices-lab-rest-order:latest rest-order

Running

Task 3.4.2 - Starting with Docker Compose

Enter a shell and change your directory to the <PROJECT_ROOT>/code/rest/docker folder.

If you have any previous lab running stop these containers

1
docker-compose down --remove-orphans

Start the microservices with

1
2
3
4
5
6
7
8
9
$ docker-compose up -d
Starting rest-alertmanager    ... done
Starting rest-jaeger          ... done
Starting rest-grafana         ... done
Starting rest-prometheus      ... done
Starting rest-stock-db        ... done
Starting rest-order-db        ... done
Starting rest-stock           ... done
Starting rest-order           ... done