Skip to main content

InfluxDB

What is InfluxDB?

InfluxDB is an open-source time-series database purpose-built for high-volume metrics, events, and IoT/analytics data. It's commonly paired with Grafana for dashboards. Laradock builds it (InfluxDB 2.x) as its own container from the official image.

Start InfluxDB

docker compose up -d influxdb

Stop InfluxDB

docker compose stop influxdb

This stops the container without deleting its data (kept in the influxdb volume). To remove the container: docker compose rm -f influxdb.

Configuration

All settings live in influxdb/defaults.env and can be overridden by adding the same line to your own .env:

VariableDefaultWhat it does
INFLUXDB_VERSION2.7Image version built via influxdb/Dockerfile.
INFLUXDB_HOST_PORT8086Host-side port InfluxDB is published on (container port 8086).
INFLUXDB_INIT_USERNAMElaradockAdmin username created on first boot.
INFLUXDB_INIT_PASSWORDsecretpasswordPassword for that admin user.
INFLUXDB_INIT_ORGlaradockOrganization created on first boot.
INFLUXDB_INIT_BUCKETdefaultBucket (database) created on first boot.

These map directly to InfluxDB's own DOCKER_INFLUXDB_INIT_* environment variables (set in influxdb/compose.yml), with DOCKER_INFLUXDB_INIT_MODE=setup triggering the automatic first-run setup.

Connect

Open the UI and API at http://localhost:8086; check readiness with curl http://localhost:8086/health. Log in with INFLUXDB_INIT_USERNAME/INFLUXDB_INIT_PASSWORD, org INFLUXDB_INIT_ORG, bucket INFLUXDB_INIT_BUCKET. From another container, use http://influxdb:8086.

Common issues

  • Port already in use on your host. Change INFLUXDB_HOST_PORT in .env and restart: docker compose up -d influxdb.
  • INFLUXDB_INIT_* changes don't take effect. These only apply during the automatic first-run setup. If InfluxDB already initialized its data volume, changing them afterward has no effect, you'd need to create a new user/org/bucket manually or start from a fresh volume.
  • Default credentials in a shared environment. secretpassword is a placeholder meant for local dev only, override INFLUXDB_INIT_PASSWORD in .env before exposing this beyond your machine.
  • App can't connect but the container is running. Confirm your app or Grafana data source uses influxdb as the host, not localhost, that only works from your host machine.

Want to chart this data with dashboards? See Grafana. Want PromQL-based metrics instead? See Prometheus. New to Laradock? Start with Getting Started.