InfluxDB is a time series database. It is often used to store data gathered from Internet of Things (IoT) devices. InfluxDB is an open-source project available under the MIT license.
This tutorial explains how to install InfluxDB inside a Docker container in the Linux. Commands have been tested on Ubuntu.
Prepare environment
Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.
Install InfluxDB
- Host network
Run the following command to create a container for InfluxDB that uses host network:
docker run -d --name=influxdb --restart=always --network=host \
-v /opt/influxdb/data:/var/lib/influxdb2 \
-v /opt/influxdb/config:/etc/influxdb2 \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME=admin \
-e DOCKER_INFLUXDB_INIT_PASSWORD=password123 \
-e DOCKER_INFLUXDB_INIT_ORG=my-org \
-e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
influxdb
- User-defined bridge network
User-defined bridge network can be used for listening on different port. By default, InfluxDB service is listening on port 8086. It can be changed with -p
option.
docker network create app-net
docker run -d --name=influxdb --restart=always --network=app-net \
-p 8080:8086 \
-v /opt/influxdb/data:/var/lib/influxdb2 \
-v /opt/influxdb/config:/etc/influxdb2 \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME=admin \
-e DOCKER_INFLUXDB_INIT_PASSWORD=password123 \
-e DOCKER_INFLUXDB_INIT_ORG=my-org \
-e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
influxdb
Note: don't forget to change admin password, organization and bucket name. The password should be 8 characters or longer.
Testing InfluxDB
Open a web browser and go to http://<IP_ADDRESS>:8086
, where <IP_ADDRESS>
is the IP address of the system. Log in to the dashboard with the admin
username and password.
Uninstall InfluxDB
To completely remove InfluxDB, remove its container:
docker rm --force influxdb
Remove InfluxDB image:
docker rmi influxdb
You can also remove InfluxDB data and configuration:
sudo rm -rf /opt/influxdb
If a user-defined bridge network was created, you can delete it as follows:
docker network rm app-net
Leave a Comment
Cancel reply