Preparing  MongoDB

Let's create our MongoDB container. We will use the official image provided by the Docker Hub.

First, we need to pull the image:

docker pull mongo:3.4.10

Then, we will see the Docker Engine downloading the image contents.

To create an isolation from our containers, we will create a separated network for our application and database. The network should use the bridge driver to allow the container communications.

Let's create a docker network:

docker network create cms-application

The command output should be an ID of a created network. Your ID will probably be different compared to mine:

To check if the network was created ...

Get Spring 5.0 By Example 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.