Grafana and InfluxDB with SSL inside a Docker Container

Next, create a config directory and create individual configuration files for Grafana […]

-->

Self-signed SSL certificates

On the host, create a directory for storing the self signed SSL certificates. This directory will be mounted in the Grafana container as well as in the InfluxDB container to /var/ssl . Create the self signed SSL certificates as follows:

Next, create a config directory and create individual configuration files for Grafana and InfluxB: mkdir conf 

Grafana

In the file ./conf/grafana/defaults.ini set the protocol to https and provide the paths to the mounted ssl directory in the container.

InfluxDB

The file ./conf/influxdb/influxdb.conf is also pretty simple. Add a [http] category and add the settings:

Environment

You can set environment variables in env files  for the services.

env.grafana

env.influxdb

Docker Compose

Now you can launch the service by using docker-compose up  for the following file. Note

Lets Encrypt Setup

If you require valid certificates, you can also use certificates from lets encrypt.

First, create the certificates on the host:

Then use this docker-compose file.

Continue reading