Creating a Docker network

We are going to deploy two servers in two separate Docker containers in the same machine: a MySQL DB server and an application server to run our microservice. The application server will need to know about the DB server to access it. The recommended way to allow two Docker containers to access each other is by deploying them in the same Docker network. A complete discussion of Docker networks is out of scope of this book, so readers are encouraged to read about Docker networks at https://docs.docker.com/engine/userguide/networking.

Knowing that the two containers we are going to create shortly need to run in the same Docker network, let’s create a Docker network by running the following command:

docker network create ...

Get Java EE 8 Development with Eclipse 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.