Home DevOpsDocker How To Install InfluxDB Telegraf and Grafana on Docker

How To Install InfluxDB Telegraf and Grafana on Docker

by schkn

This tutorial focuses on installing InfluxDB 1.7 on Docker for Linux instances.

Built in 2013 by InfluxData, InfluxDB is by far one of the most used time series databases nowadays. It is widely used for monitoring and dashboarding in the DevOps industry.

Used by many successful companies in the world, InfluxDB is often used in distributed and cloud environments in order to be highly available to the applications it is connected to.

On the other hand, Docker is a virtualization environment that provides an easy way to create, manage and delete containers on the fly.

If you are trying to build reliable monitoring architectures, one solution would be to install InfluxDB on Docker and to manage it with Kubernetes.

Note : InfluxDB is currently shifting to Influx 2.0, providing a single platform to manage all the components of the TICK stack. As a consequence, another tutorial will be available for InfluxDB 2.0.

Before starting, it is important to make ensure that all the prerequisites are met to install InfluxDB on Docker.


Sudo privileges

First of all, you need to have sudo rights on your Linux machine, otherwise you won’t be able to install InfluxDB on your host.

To verify it, run the following command

$ sudo -v

If no error messages are shown on your terminal, you are good to go.

Next, you want to make sure that Docker is correctly installed on your system.

Docker correctly installed and configured

To install Docker on Ubuntu and Debian, you can follow this tutorial.

It provides great and extensive details on how to correctly set up Docker on Linux.

Again, to verify that Docker is correctly installed, you can run the following command.

$ docker --version
Docker version 19.03.1, build 74b1e89

Now that Docker is ready, let’s have a quick look at the networking strategy we are going to use for our containers.

Designing the network strategy for InfluxDB

Before starting, it is important to have a view words about networking.

By default, containers created run on the bridge network stack.

By default, you will install InfluxDB, that will expose useful ports (like the 8086 one) to your current network stack.

Later on, you will bind Telegraf to it, but Telegraf does not have to expose any ports to your current host stack.

As a consequence, we can run InfluxDB on the default bridge network, and have Telegraf running in the same stack as InfluxDB.

Later on, we will add Grafana to our bridge network in order to visualize metrics gathered by Telegraf

Docker brigde design

Now that we have seen the network strategy we are going to use, let’s install the InfluxDB container for Docker.

To install InfluxDB on Docker, you have two ways of doing it.

You can either prepare your filesystem manually, and run the InfluxDB on a Docker container with no initialization scripts.

This is the simplest way of initializing InfluxDB.

This method should be used if you plan on running InfluxDB on a single instance, if your initial InfluxDB configuration is very simple, or if you prefer to have full control over your containers.

However, there is a way to initialize InfluxDB with scripts (either bash scripts, or InfluxQL scripts).

This is the version that you should use if you are automating a lot of servers with InfluxDB (with Chef or Puppet for example), and you want to have the same initial setup on all your instances.

Installing InfluxDB 1.7.x on Docker

The official InfluxDB image for Docker is named : influxdb.

InfluxDB image on Docker

It is part of the Docker Official Images, so you can check that you are running an official version of InfluxDB on your system.

Moreover, the other tools of the TICK stack (Telegraf, InfluxDB, Chronograf and Kapacitor) belong to the Docker Official Images.

The InfluxDB image is going to install the InfluxDB server responsible for storing time series metrics on your system.

If you are familiar with Docker, you already know that you can map volumes from your local filesystem to your container in order to manipulate data easier in your container.

This is exactly what we are going to do in this tutorial.

Configuration files as well as directories storing actual data will be stored on our local filesystem.

a – Prepare InfluxDB 1.7.x for Docker

If you carefully followed the tutorial on setting up InfluxDB on Ubuntu, you know that you are going to create a specific user for your InfluxDB database.

$ sudo useradd -rs /bin/false influxdb

In your etc directory, create a new folder for your InfluxDB configuration files.

$ sudo mkdir -p /etc/influxdb

Creating a configuration file for InfluxDB and Docker

Luckily, you don’t have to create an InfluxDB configuration file by yourself.

To create an InfluxDB configuration file using Docker, run the following command.

docker run --rm influxdb influxd config | sudo tee /etc/influxdb/influxdb.conf > /dev/null

As a quick explanation, the “influxd config” command will print a full InfluxDB configuration file for you on the standard output (which is by default your shell)

As the –rm option is set, Docker will run a container in order to execute this command and the container will be deleted as soon as it exits.

Instead of having the configuration file printed on the standard output, it will be redirected to our InfluxDB configuration file.

Next, reassign the folder permissions for your newly created file, otherwise your container won’t be able to interact with it properly.

$ sudo chown influxdb:influxdb /etc/influxdb/*
Listing InfluxDB configuration for Docker

Creating a lib folder for InfluxDB and Docker

As stated in the documentation, InfluxDB stores its data, metadata as well as the WAL (for write-ahead log) in the /var/lib/influxdb folder by default.

As a consequence, you have to create this folder if it is not currently existing.

$ sudo mkdir -p /var/lib/influxdb

Again, make sure that the permissions are correctly set for your container to write into this folder.

$ sudo chown influxdb:influxdb /var/lib/influxdb
Data folder for InfluxDB for Docker

Now that our folders are ready, let’s see how we can initialize InfluxDB with custom scripts.

Preparing initialization scripts for InfluxDB on Docker (optional)

With the InfluxDB image, there is a way to automate database initialization on your containers.

As an example, we will instruct our Docker container to create an administrator account, a regular user account (for Telegraf), and a database with a custom retention via a custom InfluxQL script.

Anatomy of the InfluxDB image

On container boot, the entrypoint.sh script is executed, it is set as the entrypoint of your Docker container.

The entry point can be executed in two ways.

You can execute the entry point script in order to launch a simple InfluxDB instance on your container.

This is for example what we have done in the previous section. We specified the configuration flag and it was used in order to set your InfluxDB server initialization.

However, there is a second way to execute the entrypoint script : by executing the init-influxdb script.

The init-influxdb script is made of two parts :

  • First, it will watch for environments variables passed to your docker command, and it will execute commands accordingly
  • Next, if you have a docker-entrypoint-initdb.d directory at the root directory of your container, it will execute either bash scripts or IQL scripts in it.

We are going to use those information to create our InfluxDB container.

First, make sure that no folders are already created in your /var/lib/influxdb folder.

$ ls -l /var/lib/influxdb
total 0

Execute the following command for meta folder (in the influxdb folder) to be updated with the correct information.

As a reminder, we want an admin account and a regular account for Telegraf (named telegraf)

Creating initialization scripts on your host

In order for the initialization scripts to be run on initialization, they have to be mapped to the docker-entrypoint-initdb.d folder in your container.

First, create a scripts folder on your host wherever you want.

In my case, it is going to be created in /etc/influxdb.

$ sudo mkdir -p /etc/influxdb/scripts

Edit a new script file on your newly created folder, and make sure to give it a .iql extension.

$ sudo touch influxdb-init.iql


This simple initialization script will create a database for weather data, and it will assign a one week retention policy for it.


The last step will be to prepare our meta folder for InfluxDB initialization.

Creating/updating the InfluxDB meta database

In order to update your meta database, run the following command

$ docker run --rm -e INFLUXDB_HTTP_AUTH_ENABLED=true \
         -e INFLUXDB_ADMIN_USER=admin \
         -e INFLUXDB_ADMIN_PASSWORD=admin123 \
         -v /var/lib/influxdb:/var/lib/influxdb \
         -v /etc/influxdb/scripts:/docker-entrypoint-initdb.d \
         influxdb /init-influxdb.sh

Note : setting the INFLUXDB_HTTP_AUTH_ENABLED to true does not mean that authentication is enabled on your InfluxDB server. Authentication is enabled in one of the next sections, this parameter is only used for the initialization script.

A couple of logs should be printed to your terminal.

If this is not the case, make sure that you specified the correct environments variables for your container.

Running the InfluxDB Docker container on Linux

If you chose to create initialization scripts for your container, you should also a log line for it.

Running initialization scripts on InfluxDB

As a last verification step, you can inspect your meta.db file in your meta folder to make sure that the changes were correctly written.

$ cat /var/lib/influxdb/meta/meta.db | grep one_week
Creating a custom retention policy for InfluxDB

Now that your InfluxDB files are prepared, let’s head over to some configuration verifications.

b – Verifying your InfluxDB configuration for Docker

If you used the configuration command detailed in the section above, you should be presented with a simple configuration file in the /etc/influxdb folder.

Open your file and verify that everything is correct.

HTTP Interface

Head over to the [http] section of your configuration and make sure that it is enabled.

Verify the bind address that should be 8086 by default.

This is the port that you are going to use to send some commands to your InfluxDB database, like creating a database or adding a user for example.

By default, authentication and encryption are disabled. However, sections at the of this tutorial explain how you can set up authentication in depth.

Data, meta and WAL configurations

By default, your configuration file should have the paths that we created in the first section, so you don’t have to change anything.

However, you should check that your paths are correct.

  dir = "/var/lib/influxdb/meta"

  dir = "/var/lib/influxdb/data"
  wal-dir = "/var/lib/influxdb/wal"

Running the InfluxDB container on Docker

We are going to use the InfluxDB image from the official Docker repositories.

As a quick reminder, you need to use the docker container run command in order to start a Docker container.

First, make sure that nothing is running on the port 8086.

$ sudo netstat -tulpn | grep 8086

If you remember correctly, we configured our folders to be accessible by the InfluxDB user (belonging in the InfluxDB group).

As a consequence, we will need the user ID of the InfluxDB user in order to run our container.

To find the InfluxDB user ID, head over to the passwd file on your host and run

$ cat /etc/passwd | grep influxdb

As you can see, the user ID for my InfluxDB user is 997.

Note : the user ID will surely be different on your system, and you should modify it accordingly when running the docker command.

To start InfluxDB on Docker, run the following command.

docker run -d -p 8086:8086 --user 997:997 --name=influxdb \ 
-v /etc/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf \ 
-v /var/lib/influxdb:/var/lib/influxdb \ 
influxdb \ 
-config /etc/influxdb/influxdb.conf 

Testing your InfluxDB container

In order to test if your InfluxDB container is correctly running, you can check that the HTTP API is correctly enabled.

$ curl -G http://localhost:8086/query --data-urlencode "q=SHOW DATABASES"
InfluxQL query via the HTTP API

You can also check that your InfluxDB server is correctly listening on port 8086 on your host.

$ netstat -tulpn | grep 8086
tcp6    0    0 :::8086      :::*       LISTEN       -


Your InfluxDB container is correctly running on Docker.

By default, your InfluxDB server does not contain any databases except for the _internal used, as its name describes, internal metrics about InfluxDB itself.

However, if you created initialization scripts for your InfluxDB database, make sure that your databases and retention policies are correctly assigned.

$ influx
Connected to http://localhost:8086 version 1.7.8
InfluxDB shell version: 1.7.7


user    admin
----    -----
admin   true

name: databases

Enabling authentication on InfluxDB for Docker

In order to enable authentication for InfluxDB 1.7.x, you are going to create an administrator account for your InfluxDB database (if you didn’t use initialization scripts)

Create an administrator account with docker exec

You don’t have to create an administrator account if you initialized your InfluxDB image with environment variables in the previous sections.

This is only necessary is you choose a fully customized InfluxDB image that you configure yourself.

To create an administrator account, connect to a bash process in your container and run the influx utility by yourself.

To achieve that, run the following commands

$ docker container ls
Listing InfluxDB Docker container images

Note : your container is not appearing here? Run this command with the -a (for all) flag to make sure that your container hasn’t crashed.

Identify the container ID of your InfluxDB container, and run the following command to have a bash in your container.

$ docker exec -it <container_id> /bin/bash

As a reminder, the docker exec is used in order to run a command in a running container.

Here are the options specified with it :

  • -i : for interactive, it will keep the standard input open even if not attached
  • -t : to allocate a pseudo-TTY to your current shell environment.

Right now, you should have a shell prompt, similar to this :

Executing a bash in a docker container

In your container, run the influx utility to create your administrator account.

$ influx
Connected to http://localhost:8086 version 1.7.8
InfluxDB shell version: 1.7.8
user  admin
----  -----
admin true

Now that you have an administrator account, you can enable the HTTP authentication for your database.

Enable HTTP Authentication in your configuration file

To achieve that, exit your container, and head to the configuration folder you created for InfluxDB.

Ctrl + D (to exit your container)

$ sudo nano /etc/influxdb/influxdb.conf

  enabled = true
  bind-address = ":8086"
  auth-enabled = true

Save your file and restart your container for the changes to be applied.

$ docker container restart <container_id>

To make sure that your changes are effective, try querying the HTTP API again.

You should be unable to execute a query without specifying the correct credentials.

$ curl -G http://localhost:8086/query --data-urlencode "q=SHOW DATABASES"
{"error":"unable to parse authentication credentials"}


Authentication is correctly enabled.

Let’s try to execute the InfluxQL query again with correct credentials.

$ curl -G -u admin:admin123 http://localhost:8086/query --data-urlencode "q=SHOW DATABASES"


With this curl command, we made sure that our credentials were correctly set up for our InfluxDB server.

Now that your time series database is up and running, it is time to install our metrics collection agent : Telegraf.

Installing Telegraf on Docker

For those who are not familiar with Telegraf, Telegraf is a plugin-driven agent that periodically collects metrics about a variety of different systems.

The metrics are pushed to InfluxDB and they can be later on analyzed in Chronograf or Grafana.

Luckily, Telegraf also belongs to the official Docker images.

Telegraf image for Docker

In this section, we are going to configure Telegraf for it to gather system metrics on our Linux host (in this case, a Debian 10, but it works in the same way for Ubuntu based ones)

Prepare Telegraf for InfluxDB and Docker

Similarly to our InfluxDB setup, we are going to create a Telegraf user for our host. It ensures that correct permissions are set for our future configuration files.

$ sudo useradd -rs /bin/false telegraf

In your etc directory, create a new folder for your Telegraf configuration files.

$ sudo mkdir -p /etc/telegraf

Creating a configuration file for Telegraf and Docker

Again, we don’t have to create a Telegraf configuration file by ourselves.

The Telegraf Docker image is built very closely to the InfluxDB one.

As a consequence, it it able to run a simple telegraf config command to generate a configuration on the fly.

By default, the Telegraf configuration file has the following defaults :

  • interval : 10 seconds. Telegraf is going to gather and send metrics to InfluxDB every 10 seconds.
  • round_interval : true. The agent is going to collect metrics on :00, :10, or :(00 + n*interval)
  • The InfluxDB output plugin is enabled by default.
  • The CPU, disk, diskio, kernel, memory, processes, swap and system inputs plugins are enabled. As those inputs use the /proc mountpoint to gather metrics, we will have to remap volumes on the container.

To create a Telegraf configuration file using Docker, run the following command.

docker run --rm telegraf telegraf config | sudo tee /etc/telegraf/telegraf.conf > /dev/null
Creating a configuration file for Telegraf Docker

Next, reassign the correct permissions to your Telegraf configuration folder.

This will ensure that only Telegraf itself and the root account are able to write to the configuration file.

$ sudo chown telegraf:telegraf /etc/telegraf/*

Modify your Telegraf configuration file

With Telegraf, most of the time, you will want to send metrics directly to InfluxDB itself.

This is why the InfluxDB output is enabled by default in your Telegraf configuration file.

By default, Telegraf will send metrics to a database named “telegraf” on InfluxDB.

This is a customizable parameter, however in this case we are only going to specify the InfluxDB authentication parameters.

Edit your Telegraf configuration file, and locate the [[outputs.influxdb]] section.

Sending metrics to InfluxDB via Telegraf

In this configuration file, locate the “HTTP Basic Auth” section and modify the credentials accordingly.

## HTTP Basic Auth
username = "admin"
password = "admin123"

You are of course free to create a dedicated administrator account for Telegraf by using the method we described above (using docker exec)

Save and exit your file, now it is time to run the container.

Running the Telegraf container on Docker

As stated before, Telegraf enables system inputs by default.

As a consequence, we will have to remap the /proc host folder to the /host folder on our Docker image.

This is made to ensure that Telegraf is not gathering metrics from the Docker container itself, and that the container filesystem is not altered in any ways.

To achieve this, unless you gave a name to your InfluxDB container, run this command to get your InfluxDB container ID.

It will be used to connect Telegraf and InfluxDB to the same virtual network.

$ docker container ls | grep influxdb
1939ba611410   influxdb   "/entrypoint.sh -conf..."   24 minutes ago    Up 30 minutes>8086/tcp    ecstatic_moore

Isolate your Telegraf user ID by running the following command.

$ getent passwd | grep telegraf

Next, to run the Telegraf Docker image, run the following command.

$ docker run -d --user 998:998 --name=telegraf \
      --net=container:<influx_container_id> \
      -e HOST_PROC=/host/proc \
      -v /proc:/host/proc:ro \
      -v /etc/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro \

Note : the net option can be replaced by –net=influxdb if you chose to create your InfluxDB container with a name.


To make sure your Telegraf instance is running correctly, run the following command.

$ docker container logs -f --since 10m telegraf
Inspecting Docker logs for Telegraf

Telegraf seems no to raise any error messages, but let’s double check the correctness of our setup by inspecting the InfluxDB database.

$ docker exec -it <container_id> influx -username admin -password admin123

InfluxDB shell version 1.7.8

name: databases

> USE telegraf
> SELECT * FROM cpu WHERE time < now() - 1m

If you are seeing data points, congratulations!

Your Telegraf instance is correctly sending metrics to your InfluxDB server.

Selecting results in InfluxDB

Now that all metrics are stored in Telegraf, for one week, we can install a modern dashboarding tool in order to visualize them : Grafana.

Visualizing Telegraf metrics in Grafana

For those who are unfamiliar with Grafana, Grafana is a dashboarding tool that binds to a wide variety of different datasources in order to create beautiful graphs.

It can bind to traditional SQL databases, but it can also bind to time series databases, which is what we are going to do in this section.

Installing Grafana on Docker

The Grafana docker image is stored under the Grafana repository.

Grafana image for Docker

To create a Grafana container, run the following command on your host.

$ docker run -d --name=grafana -p 3000:3000 grafana/grafana

A Grafana server container should now be up and running on your host. To make sure of it, run the following command.

$ docker container ls | grep grafana

You can also make sure that it is correctly listening on port 3000.

$ netstat -tulpn | grep 3000

Configuring Grafana for InfluxDB

With your web browser, head over to http://localhost:3000

You should be redirected to Grafana home page.

The default credentials for Grafana are admin/admin.

Immediately, you are asked to change your password. Choose a strong password and click on “Save

Grafana change password window

You should now be redirected to the Grafana default Web UI.

Add a datasource panel in grafana

Click on “Add data source” to add an InfluxDB datasource.

Adding InfluxDB as a datasource in Grafana

Next, select the InfluxDB option and click on “Select“.

For this tutorial, we are not using InfluxDB images as Docker services. As a consequence, we have to isolate InfluxDB public IP on our bridge network.

To do that, run the following command

$ docker network inspect bridge | grep influxdb -A 5
"Name": "influxdb",
"EndpointID": "7e4eb0574a346687efbb96b6b45",
"MacAddress": "02:42:ac:11:00:04",
"IPv4Address": "",
"IPv6Address": ""

Copy the IPv4 address and paste it in the InfluxDB configuration for Grafana.

Select the Basic Auth option, specify your administrator credentials, and fill the details about your InfluxDB database.

Here is the final configuration.

InfluxDB configuration for Grafana and Docker

Click on “Save and Test” to make sure that your configuration is working properly.


Now that everything is set up in Grafana, let’s import a dashboard designed for Telegraf host metrics.

Importing a Grafana dashboard

To import a Grafana dashboard, select the “Plus” icon in the left menu, and click on “Import“.

Import a Grafana dashboard

In the import text box, put 1443 as a dashboard ID.

Import a Grafana dashboard by ID

In the next window, make sure that the information are correct and bind it to your newly created datasource.

Importing a custom dashboard in Grafana

Click on “Import” and your dashboard should be up and running!

Final dashboard in Grafana


Congratulations, you learnt how to install InfluxDB 1.7.x, Telegraf and Grafana using Docker.

As you probably realized, this tutorial focuses on a fully customizable installation of your images.

If you want to automate your container setups, it might be a good idea to use docker-compose.

Also, make sure to read through the entire list of Telegraf input plugins to start getting ideas about what to monitor.

Until then, have fun, as always.

You may also like


Links 7/10/2019: Pinebook Pro Shipping, Linux 5.4 RC2, Godot 3.2 Alpha, FSF and GNU Statement | Techrights October 7, 2019 - 9:56 am

[…] How To Install InfluxDB Telegraf and Grafana on Docker […]

Paul November 14, 2019 - 10:00 pm

I’m new to docker, but carefully following your tutorial – thanks for posting!
I’ve got as far as;
$ docker run –rm -e INFLUXDB_HTTP_AUTH_ENABLED=true \
-v /var/lib/influxdb:/var/lib/influxdb \
-v /etc/influxdb/scripts:/docker-entrypoint-initdb.d \
influxdb /init-influxdb.sh
But the command is not successful & no logs are printed.
I guess I’m now at “If this is not the case, make sure that you specified the correct environments variables for your container.” but… not sure what you mean by this??
I added influxdb simply by ‘docker pull influxdb’ have I done something wrong?

schkn November 14, 2019 - 11:05 pm


Can you try inspecting the logs of your container?


Try hitting the “docker container ps -a” command in order to get your container ID

Paul November 14, 2019 - 10:42 pm

The error message is:

influxdb init process in progress…
ts=2019-11-14T22:36:23.385319Z lvl=info msg=”InfluxDB starting” log_id=0J70oRrG000 version=1.7.9 branch=1.7 commit=23bc63d43a8dc05f53afa46e3526ebb5578f3d88
ts=2019-11-14T22:36:23.385359Z lvl=info msg=”Go runtime” log_id=0J70oRrG000 version=go1.12.6 maxprocs=2
run: create server: mkdir all: mkdir /var/lib/influxdb/meta: permission denied
influxdb init process in progress…

Does the last command need to be run as sudo?

schkn November 14, 2019 - 11:20 pm

Mmh, given that you gave the correct file permissions to the /var/lib/influxdb directory (chown influxdb:influxdb), can you try
to execute your last command by specifying the influxdb user? (–user 997:997 in your previous command)

Paul November 15, 2019 - 1:17 pm

/var/lib/influxdb permissions are influxdb:influxdb

If I try;
docker run –rm -e –user 997:997 INFLUXDB_HTTP_AUTH_ENABLED=true \
-v /var/lib/influxdb:/var/lib/influxdb \
-v /etc/influxdb/scripts:/docker-entrypoint-initdb.d \
influxdb /init-influxdb.sh

I get;

Unable to find image ‘997:997’ locally
Trying to pull repository docker.io/library/997 …
pull access denied for 997, repository does not exist or may require ‘docker login’
docker: pull access denied for 997, repository does not exist or may require ‘docker login’.

Don’t know if it helps, but the process that I used to install docker was;

yum-config-manager –enable ol7_addons
yum install docker-engine
systemctl start docker
systemctl enable docker
groupadd docker
service docker restart
usermod -a -G docker opc

David November 15, 2019 - 5:51 pm

Is there a command missing from the tutorial after this sentence?

“Execute the following command for meta folder (in the influxdb folder) to be updated with the correct information.”

Paul November 18, 2019 - 11:57 pm

Ok… I’ve started with a new Oracle VM instance, followed your tutorial exactly, and got the exactly the same result, as I’ve commented above.
Time to call it a day. I’ve now installed the TIG individually without docker, or this tutorial, and it’s working well, so no need to respond further.

Ivan January 1, 2020 - 1:43 pm

I have same problem and here is the log message.
run: open server: open tsdb store: mkdir /var/lib/influxdb/data/_internal/_series: permission denied
I have been following the whole process and i was able to make it work after using
sudo docker *the rest of the command*

Ivan January 1, 2020 - 2:04 pm

When I connect to the influxDB shell i have this error:
“There was an error writing history file: open /.influx_history: permission denied”
it seems that the problem is not solved at all.

schkn January 1, 2020 - 4:29 pm


Are you sure that you mapped the volumes correctly?

Ivan January 4, 2020 - 12:47 pm

I was sure. Now I don’t know anymore for i have been doing so many tests with that. I will go back to that. BTW, thank you for your posts, even though I was not able to do exactly like you describes here, since I am using the docker-compose it got a little messy but i was able to get the idea of using the /etc for the config files instead of other ways i found online (which i am not really happy with) now i have the config files on /etc and it feels more ‘natural’. 🙂
I found here using medium. I will look for other post of you.
Thank you once again.

schkn January 4, 2020 - 5:59 pm

My pleasure!

Make sure to leave comments if you are having trouble with the tools, I will try to solve them.


Alejandro Guevara April 13, 2020 - 3:05 pm


I’m having the same issue here:

[[email protected] influxdb]# docker exec -it c0761075cba0 /bin/bash
I have no [email protected]:/$ influx
Connected to http://localhost:8086 version 1.7.10
InfluxDB shell version: 1.7.10
There was an error writing history file: open /.influx_history: permission denied

Also look there is no name on my container.

How did you solved the issue?

Thanks in advance for your help.

Christian September 25, 2020 - 11:18 pm

I am also experiencing this error. I am doing this as an exercise and running all commands as `root`, so I skipped the part where you optionally create an admin user for Influx. I think I will reset my VM to the last snapshot which will take me back to the beginning of the tutorial. This time, I will create the optional admin user.

BTW your tutorial is brilliant so far. 🙂

mambot January 13, 2020 - 9:21 pm

Great !

Eric Muheto February 14, 2020 - 7:13 pm

Hello Schkn, the API is not responding and thus telegraf cant create the database in influxdb. What to do? I followed the tutorial carefully. I can connect to the influxdb container and see that the databse I created is in there.

THis is the error from telegraf:
Feb 14 19:10:40 hwd-influxp-2.cn.ca telegraf[1647]: 2020-02-14T19:10:40Z E! [agent] Error writing to outputs.influxdb: could not write any address

Feb 14 19:10:50 hwd-influxp-2.cn.ca telegraf[1647]: 2020-02-14T19:10:50Z E! [outputs.influxdb] When writing to [http://localhost:8086]: database “telegraf” not found and failed to recreate

If I do normal curl to see if I can connect to localhost:8086, this is what I get:
* About to connect() to localhost port 8086 (#0)
* Trying…
* Connected to localhost ( port 8086 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8086
> Accept: */*
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< X-Influxdb-Build: OSS
< X-Influxdb-Version: 1.7.9
< Date: Fri, 14 Feb 2020 19:12:23 GMT
< Content-Length: 19
404 page not found
* Connection #0 to host localhost left intact

What can I do to solve this issue? Thanks

schkn February 15, 2020 - 9:18 am

Are you sure that the InfluxDB database is running properly?

What happens if you simply execute “influx” in order to start an InfluxDB client?


Brendon May 22, 2020 - 11:05 pm

Hi Schkn,

Thanks for your post. I did follow this tutorial to set up TIG stack in docker but it appears there is issue when telegraf tried to write data to influxDB. I troubleshoot on network,permission,configuration with different scenarios but there is still issue with connection refuse as below.

22:32:00Z E! [outputs.influxdb] When writing to []: Post dial tcp connect: connection refused
2020-05-22T22:32:00Z E! [agent] Error writing to outputs.influxdb: could not write any address
2020-05-22T22:32:02Z I! [agent] Hang on, flushing any cached metrics before shutdown
2020-05-22T22:32:02Z E! [outputs.influxdb] When writing to []: Post dial tcp connect: connection refused
2020-05-22T22:32:02Z E! [agent] Error writing to outputs.influxdb: could not write any address

Any idea that what I have missed?

Thank you

bob August 6, 2020 - 1:25 pm

in your instructions you do not mention that you need to create the database telegraph … following to a T yeilds a failure 🙁 [i copy pasted every commands] also there is a section with spaces after the \ wich speparates the comands.

i think i am close … i can see the wether database but looks like telegraph did not create the DB by itself. ( yeah i modified the credentials :-/ now i cant even create the db … its asking me to select a db … ( i am creating it !) 😛

BOB August 6, 2020 - 2:08 pm

nevermind that people dont forget to check the uids 😛 also after running the instance for influx make sure you chown the meta.db .. because its created by the running user not the one in the docker container.

Michael Nilsson October 30, 2020 - 5:35 pm

Hi! Just wanted to pitch in after struggling with the “permission denied”-issue for many hours:
It seems InfluxDB is working even though the error message appears.

kira March 10, 2021 - 1:59 pm

i am getting this error
/entrypoint.sh: line 303: /init-influxdb.sh: No such file or directory
any idea why?

id-7 April 22, 2021 - 9:39 pm

i too got that error and cannot find a fix

Andrea April 11, 2021 - 10:55 am

Hello, when I execute the “docker run –rm influxdb influxd config | sudo tee /etc/influxdb/influxdb.conf > /dev/null” command I get an error saying “Error: unknown command “config” for “influxd””. Any idea why? Thanks!

DK November 19, 2021 - 8:39 am

This means you do not have influxdb installed on your machine. I also got the same error and then I installed influxdb. you can use either # yum install influxdb OR # apt-get install influxdb. And then you won’t get this error.

Michal February 16, 2022 - 9:35 pm

Hey schkn

I got the same issue any idea what that could be?

Thomas May 13, 2021 - 2:25 pm

Hi Andrea, there is an error in the command. Took me a while to find out. It should be

docker run –rm influxdb influxd print-config | sudo tee /etc/influxdb/influxdb.conf > /dev/null


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.