Running Prometheus on Docker

After having created the configuration file, we can use a volume mount to inject this configuration file into the Docker containers we are about to start.

For this example, we will assume that you have the MyEvents application running in Docker containers on your local machine and that the containers are attached to a container network named myevents (whether you created the containers manually or via Docker Compose does not really matter).

For this reason, starting both applications is easy enough. We'll start by defining a separate container network for the monitoring components:

$ docker network create monitoring 

Next, create a new volume in which the Prometheus server can store its data:

$ docker volume create ...

Get Cloud Native programming with Golang now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.