Https Setup for influxdb docker image

I am trying to setup https with influx docker image. I followed steps given in documentation here: HTTPS Setup | InfluxDB OSS 1.3 Documentation and generated certs, stored them at required location and added that location to influxdb.conf. Now it is unable to find the file, so I wanted to check if influxdb container would be able to get these certs from local machine where infludb docker is running or they have to be stored inside the container along with influxdb?

Hello,

You should mount docker volume with local directory which contain Your certficate, lets say that you have Your certificate files (certificate.pem or certificate.crt and certificate.key) under “/opt/ssl” then You should mount volume like this:
-v /opt/ssl/:/etc/ssl/

And of course don’t forget to set environment variables for InfluxDB, something like:
-e INFLUXDB_HTTP_HTTPS_ENABLED=true -e INFLUXDB_HTTP_HTTPS_CERTIFICATE=/etc/ssl/certificate.pem -e INFLUXDB_HTTP_HTTPS_PRIVATE_KEY=/etc/ssl/certificate.key

1 Like

Even after mounting the volume I get an error:
run: open server: open service: open /etc/ssl/influxdb-selfsigned.crt: no such file or directory,

I ran the command:
docker run -p 8086:8086 -v /etc/ssl:/etc/ssl containerID

and was using dockerfile from here: https://github.com/influxdata/influxdata-docker/blob/aaf314faf2b99c433ced64ad40c4d10c3ca6d718/influxdb/1.3/alpine/Dockerfile

Hello,

Does Your local directory /etc/ssl contains influxdb-selfsigned.crt and .key?

docker run -p 8086:8086 -v /etc/ssl:/etc/ssl -e INFLUXDB_HTTP_HTTPS_ENABLED=true -e INFLUXDB_HTTP_HTTPS_CERTIFICATE=/etc/ssl/influxdb-selfsigned.crt -e INFLUXDB_HTTP_HTTPS_PRIVATE_KEY=/etc/ssl/influxdb-selfsigned.key containerID