docker.recipes

InfluxDB + Chronograf

intermediate

InfluxDB time-series database with Chronograf admin UI.

Overview

InfluxDB is a purpose-built time-series database designed specifically for handling high-velocity, timestamped data from IoT sensors, application metrics, and monitoring systems. Originally developed by InfluxData in 2013, it addresses the unique challenges of time-series data through specialized storage engines, query optimization for temporal patterns, and built-in retention policies that automatically manage data lifecycle. Unlike traditional relational databases, InfluxDB excels at ingesting millions of data points per second while providing sub-second query performance for analytics and alerting. This stack combines InfluxDB 2.7 with Chronograf to create a comprehensive time-series data platform. While InfluxDB 2.x includes a built-in UI, Chronograf provides advanced visualization capabilities, alerting rules, and administrative tools that complement InfluxDB's native interface. The configuration establishes automatic initialization with organization, bucket, and authentication setup, plus inter-service connectivity for data exploration and dashboard creation. This combination is ideal for DevOps teams implementing observability solutions, IoT developers collecting sensor data, and organizations requiring real-time analytics on timestamped metrics. The stack provides both the high-performance data storage capabilities of InfluxDB and the intuitive visualization tools of Chronograf, making it accessible for both technical operators and business users who need to analyze time-series patterns.

Key Features

  • High-performance time-series storage engine optimized for timestamped data ingestion and retrieval
  • Flux query language with advanced time-series functions for complex temporal analytics
  • Built-in data retention policies with automatic downsampling and expiration management
  • Chronograf's drag-and-drop dashboard builder with time-series specific visualizations
  • Real-time alerting system with customizable thresholds and notification channels
  • Multi-tenant organization and bucket structure for data isolation and access control
  • Native support for both push and pull data collection patterns
  • Advanced time-series functions including aggregations, transformations, and predictive analytics

Common Use Cases

  • 1IoT sensor networks collecting temperature, humidity, and environmental data from distributed devices
  • 2Application performance monitoring with metrics collection from microservices architectures
  • 3Financial data analysis for real-time trading metrics and market data aggregation
  • 4Industrial equipment monitoring for predictive maintenance and operational efficiency
  • 5Website analytics tracking user behavior patterns and performance metrics over time
  • 6Energy management systems monitoring power consumption and grid performance data
  • 7DevOps infrastructure monitoring collecting system metrics, logs, and performance indicators

Prerequisites

  • Minimum 1GB RAM allocated to Docker (InfluxDB requires 256MB minimum, 1GB+ recommended for production)
  • Available ports 8086 (InfluxDB) and 8888 (Chronograf) on the host system
  • Basic understanding of time-series data concepts and Flux or InfluxQL query syntax
  • Environment variables configured for INFLUX_USER, INFLUX_PASSWORD, INFLUX_ORG, INFLUX_BUCKET, and INFLUX_TOKEN
  • Docker Compose version 3.8 or higher with volume and network support
  • Understanding of InfluxDB's bucket and organization concepts for proper data modeling

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 influxdb:
3 image: influxdb:2.7
4 container_name: influxdb
5 restart: unless-stopped
6 environment:
7 DOCKER_INFLUXDB_INIT_MODE: setup
8 DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUX_USER}
9 DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUX_PASSWORD}
10 DOCKER_INFLUXDB_INIT_ORG: ${INFLUX_ORG}
11 DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUX_BUCKET}
12 DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUX_TOKEN}
13 volumes:
14 - influxdb_data:/var/lib/influxdb2
15 - influxdb_config:/etc/influxdb2
16 ports:
17 - "8086:8086"
18 networks:
19 - influx-network
20
21 chronograf:
22 image: chronograf:latest
23 container_name: chronograf
24 restart: unless-stopped
25 environment:
26 INFLUXDB_URL: http://influxdb:8086
27 volumes:
28 - chronograf_data:/var/lib/chronograf
29 ports:
30 - "8888:8888"
31 depends_on:
32 - influxdb
33 networks:
34 - influx-network
35
36volumes:
37 influxdb_data:
38 influxdb_config:
39 chronograf_data:
40
41networks:
42 influx-network:
43 driver: bridge

.env Template

.env
1INFLUX_USER=admin
2INFLUX_PASSWORD=changeme123
3INFLUX_ORG=myorg
4INFLUX_BUCKET=mybucket
5INFLUX_TOKEN=my-super-secret-token

Usage Notes

  1. 1Docs: https://docs.influxdata.com/influxdb/v2/
  2. 2Access InfluxDB UI at http://localhost:8086 | Chronograf at http://localhost:8888
  3. 3Use INFLUX_TOKEN for API authentication in your applications
  4. 4Query with Flux or InfluxQL - Flux recommended for v2.x
  5. 5Retention policies control data lifecycle - configure per bucket
  6. 6Backup: influx backup /path/to/backup, restore with influx restore

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

influxdb
influxdb:
  image: influxdb:2.7
  container_name: influxdb
  restart: unless-stopped
  environment:
    DOCKER_INFLUXDB_INIT_MODE: setup
    DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUX_USER}
    DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUX_PASSWORD}
    DOCKER_INFLUXDB_INIT_ORG: ${INFLUX_ORG}
    DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUX_BUCKET}
    DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUX_TOKEN}
  volumes:
    - influxdb_data:/var/lib/influxdb2
    - influxdb_config:/etc/influxdb2
  ports:
    - "8086:8086"
  networks:
    - influx-network
chronograf
chronograf:
  image: chronograf:latest
  container_name: chronograf
  restart: unless-stopped
  environment:
    INFLUXDB_URL: http://influxdb:8086
  volumes:
    - chronograf_data:/var/lib/chronograf
  ports:
    - "8888:8888"
  depends_on:
    - influxdb
  networks:
    - influx-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 influxdb:
5 image: influxdb:2.7
6 container_name: influxdb
7 restart: unless-stopped
8 environment:
9 DOCKER_INFLUXDB_INIT_MODE: setup
10 DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUX_USER}
11 DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUX_PASSWORD}
12 DOCKER_INFLUXDB_INIT_ORG: ${INFLUX_ORG}
13 DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUX_BUCKET}
14 DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUX_TOKEN}
15 volumes:
16 - influxdb_data:/var/lib/influxdb2
17 - influxdb_config:/etc/influxdb2
18 ports:
19 - "8086:8086"
20 networks:
21 - influx-network
22
23 chronograf:
24 image: chronograf:latest
25 container_name: chronograf
26 restart: unless-stopped
27 environment:
28 INFLUXDB_URL: http://influxdb:8086
29 volumes:
30 - chronograf_data:/var/lib/chronograf
31 ports:
32 - "8888:8888"
33 depends_on:
34 - influxdb
35 networks:
36 - influx-network
37
38volumes:
39 influxdb_data:
40 influxdb_config:
41 chronograf_data:
42
43networks:
44 influx-network:
45 driver: bridge
46EOF
47
48# 2. Create the .env file
49cat > .env << 'EOF'
50INFLUX_USER=admin
51INFLUX_PASSWORD=changeme123
52INFLUX_ORG=myorg
53INFLUX_BUCKET=mybucket
54INFLUX_TOKEN=my-super-secret-token
55EOF
56
57# 3. Start the services
58docker compose up -d
59
60# 4. View logs
61docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/influxdb-chronograf/run | bash

Troubleshooting

  • Connection refused on port 8086: Ensure InfluxDB container is fully started and DOCKER_INFLUXDB_INIT_MODE environment variables are properly set
  • Chronograf shows 'Unable to connect to InfluxDB': Verify the INFLUXDB_URL environment variable points to http://influxdb:8086 and both containers are on the same network
  • Authentication failures with INFLUX_TOKEN: Check that the token matches between InfluxDB initialization and client applications, and verify token has proper read/write permissions
  • High memory usage during data ingestion: Configure appropriate retention policies and batch write sizes, monitor for inefficient Flux queries causing memory spikes
  • Empty dashboards in Chronograf: Ensure data is being written to the correct bucket and organization, verify Chronograf is connected to the right InfluxDB instance
  • Time zone issues in data visualization: Configure proper timezone settings in both InfluxDB and Chronograf, ensure client applications send UTC timestamps

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space