Documentation

Install and run InfluxDB using Docker

This page documents an earlier version of InfluxDB OSS. InfluxDB 3 Core is the latest stable version.

Install and run InfluxDB OSS v1.x using Docker containers. This guide covers Docker installation, configuration, and initialization options.

Install and run InfluxDB

Pull the InfluxDB v1.x image

docker pull influxdb:1.12.2

Start InfluxDB

Start a basic InfluxDB container with persistent storage:

docker run -p 8086:8086 \
  -v $PWD/data:/var/lib/influxdb \
  influxdb:1.12.2

InfluxDB is now running and available at http://localhost:8086.

Configure InfluxDB

Using environment variables

Configure InfluxDB settings using environment variables:

docker run -p 8086:8086 \
  -v $PWD/data:/var/lib/influxdb \
  -e INFLUXDB_REPORTING_DISABLED=true \
  -e INFLUXDB_HTTP_AUTH_ENABLED=true \
  -e INFLUXDB_HTTP_LOG_ENABLED=true \
  influxdb:1.12.2

Using a configuration file

Generate a default configuration file:

docker run --rm influxdb:1.12.2 influxd config > influxdb.conf

Start InfluxDB with your custom configuration:

docker run -p 8086:8086 \
  -v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
  -v $PWD/data:/var/lib/influxdb \
  influxdb:1.12.2

Initialize InfluxDB

Automatic initialization (for development)

Automatic initialization with InfluxDB v1 is not recommended for production. Use this approach only for development and testing.

Automatically create a database and admin user on first startup:

docker run -p 8086:8086 \
  -v $PWD/data:/var/lib/influxdb \
  -e INFLUXDB_DB=mydb \
  -e INFLUXDB_HTTP_AUTH_ENABLED=true \
  -e INFLUXDB_ADMIN_USER=admin \
  -e INFLUXDB_ADMIN_PASSWORD=supersecretpassword \
  influxdb:1.12.2

Environment variables for user creation:

  • INFLUXDB_USER: Create a user with no privileges
  • INFLUXDB_USER_PASSWORD: Password for the user
  • INFLUXDB_READ_USER: Create a user who can read from INFLUXDB_DB
  • INFLUXDB_READ_USER_PASSWORD: Password for the read user
  • INFLUXDB_WRITE_USER: Create a user who can write to INFLUXDB_DB
  • INFLUXDB_WRITE_USER_PASSWORD: Password for the write user

Custom initialization scripts

InfluxDB v1.x Docker containers support custom initialization scripts for testing scenarios:

Create an initialization script (init-scripts/setup.iql):

CREATE DATABASE sensors;
CREATE DATABASE logs;

CREATE USER "telegraf" WITH PASSWORD 'secret123';
GRANT WRITE ON "sensors" TO "telegraf";

CREATE USER "grafana" WITH PASSWORD 'secret456';
GRANT READ ON "sensors" TO "grafana";
GRANT READ ON "logs" TO "grafana";

CREATE RETENTION POLICY "one_week" ON "sensors" DURATION 1w REPLICATION 1 DEFAULT;

Run with initialization scripts:

docker run -p 8086:8086 \
  -v $PWD/data:/var/lib/influxdb \
  -v $PWD/init-scripts:/docker-entrypoint-initdb.d \
  influxdb:1.12.2

Supported script types:

  • Shell scripts (.sh)
  • InfluxDB query language files (.iql)

Initialization scripts only run on first startup when the data directory is empty. Scripts execute in alphabetical order based on filename.

Access the InfluxDB CLI

To access the InfluxDB command line interface from within the Docker container:

docker exec -it <container-name> influx

Replace <container-name> with your InfluxDB container name or ID.

Next steps

Once you have InfluxDB running in Docker, see the Get started guide to:

  • Create databases
  • Write and query data
  • Learn InfluxQL basics

Was this page helpful?

Thank you for your feedback!


New in InfluxDB 3.5

Key enhancements in InfluxDB 3.5 and the InfluxDB 3 Explorer 1.3.

See the Blog Post

InfluxDB 3.5 is now available for both Core and Enterprise, introducing custom plugin repository support, enhanced operational visibility with queryable CLI parameters and manual node management, stronger security controls, and general performance improvements.

InfluxDB 3 Explorer 1.3 brings powerful new capabilities including Dashboards (beta) for saving and organizing your favorite queries, and cache querying for instant access to Last Value and Distinct Value caches—making Explorer a more comprehensive workspace for time series monitoring and analysis.

For more information, check out:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On November 3, 2025, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2