LibreNMS on Docker

LibreNMS is an open-source, auto-discovering network monitoring platform — SNMP polling, alerting, performance graphing, and OS detection across switches, routers, servers, and more, all from a single web UI. This guide deploys the official multi-container stack with Docker Compose: MariaDB for persistence, Redis for caching and the dispatcher queue, an msmtpd mailer, plus optional sidecars for the poller dispatcher, SNMP trap handling, and syslog ingestion.

Stack: librenms · mariadb · redis · msmtpd  ·  Sidecars: dispatcher · snmptrapd · syslog-ng  ·  OS: Linux
01 — Prerequisites
RequirementNotes
Docker + ComposeDocker Engine v24+ and the Compose v2 plugin installed on the host
Linux serverUbuntu 22.04+ or Debian 11+ recommended; a static IP or DHCP reservation that can reach the devices you intend to monitor
Port 8000The web UI is published on TCP 8000 by default — adjust firewall rules so you can reach it
SNMP reachabilityUDP 161 open from the LibreNMS host to each monitored device; SNMP must be enabled on those devices
ℹ  LibreNMS ships its own copy of every dependency inside the official image — there is no Composer step and no PHP install on the host. The container is self-contained.
02 — Fetch the Example Compose Files

The LibreNMS project maintains a ready-to-use Compose example. Download the archive, extract it, and work from the examples/compose directory. All paths in later steps are relative to that folder.

Download & extract
mkdir librenms cd librenms wget https://github.com/librenms/docker/archive/refs/heads/master.zip unzip master.zip cd docker-master/examples/compose
Files you now have
examples/compose/ ├── compose.yml ← service definitions ├── .env ← Docker / database variables ├── librenms.env ← LibreNMS app configuration └── msmtpd.env ← outbound mail (optional)
03 — Configure the Environment

Two files drive the deployment. Edit .env for the timezone and database credentials, and librenms.env for application-level settings such as the SNMP community and worker counts. The database password is referenced by the db and librenms services through these variables, so set it once here.

.env
TZ=Europe/Lisbon PUID=1000 PGID=1000 MYSQL_DATABASE=librenms MYSQL_USER=librenms MYSQL_PASSWORD=StrongPasswordHere
librenms.env (key settings)
MEMORY_LIMIT=256M MAX_INPUT_VARS=1000 UPLOAD_MAX_SIZE=16M LIBRENMS_SNMP_COMMUNITY=librenmsdocker REDIS_HOST=redis LIBRENMS_SERVICE_POLLER_WORKERS=16 LIBRENMS_SERVICE_DISCOVERY_WORKERS=16
⚠  Replace StrongPasswordHere with a strong password. Set TZ to your real timezone — a mismatched timezone produces misleading graph timestamps and alert times.
04 — Review the Compose File

The official compose.yml defines the core services plus three optional sidecars. The db and redis services back the application; msmtpd relays mail. The dispatcher, snmptrapd, and syslogng containers reuse the same image with a sidecar flag. The structure below is abbreviated from the upstream example.

compose.yml (abbreviated)
services: db: image: mariadb:lts container_name: librenms_db command: - "mysqld" - "--innodb-file-per-table=1" - "--lower-case-table-names=0" volumes: - "./db:/var/lib/mysql" environment: - "TZ=${TZ}" - "MYSQL_DATABASE=${MYSQL_DATABASE}" - "MYSQL_USER=${MYSQL_USER}" - "MYSQL_PASSWORD=${MYSQL_PASSWORD}" - "MYSQL_RANDOM_ROOT_PASSWORD=yes" restart: always redis: image: redis:alpine container_name: librenms_redis environment: - "TZ=${TZ}" restart: always msmtpd: image: crazymax/msmtpd:latest container_name: librenms_msmtpd env_file: - "./msmtpd.env" restart: always librenms: image: librenms/librenms:latest container_name: librenms hostname: librenms cap_add: - NET_ADMIN - NET_RAW ports: - target: 8000 published: 8000 protocol: tcp depends_on: - db - redis - msmtpd volumes: - "./librenms:/data" env_file: - "./librenms.env" environment: - "TZ=${TZ}" - "PUID=${PUID}" - "PGID=${PGID}" - "DB_HOST=db" - "DB_NAME=${MYSQL_DATABASE}" - "DB_USER=${MYSQL_USER}" - "DB_PASSWORD=${MYSQL_PASSWORD}" - "DB_TIMEOUT=60" restart: always dispatcher: image: librenms/librenms:latest container_name: librenms_dispatcher hostname: librenms-dispatcher cap_add: - NET_ADMIN - NET_RAW depends_on: - librenms - redis volumes: - "./librenms:/data" env_file: - "./librenms.env" environment: - "TZ=${TZ}" - "PUID=${PUID}" - "PGID=${PGID}" - "DB_HOST=db" - "DB_NAME=${MYSQL_DATABASE}" - "DB_USER=${MYSQL_USER}" - "DB_PASSWORD=${MYSQL_PASSWORD}" - "DISPATCHER_NODE_ID=dispatcher1" - "SIDECAR_DISPATCHER=1" restart: always
ℹ  The snmptrapd and syslogng sidecars follow the same pattern with SIDECAR_SNMPTRAPD=1 / SIDECAR_SYSLOGNG=1 and publish ports 162 and 514 respectively. Leave them out if you don't need trap or syslog ingestion yet — you can add them later.
05 — Start the Stack

From inside examples/compose, bring everything up. On first start the LibreNMS container creates the database schema and runs migrations automatically — this can take a minute or two.

Bring everything up
sudo docker compose up -d
Watch the first-run migration
sudo docker compose logs -f librenms
Verify the containers are running
sudo docker compose ps NAME IMAGE STATUS librenms librenms/librenms:latest Up librenms_db mariadb:lts Up librenms_redis redis:alpine Up librenms_msmtpd crazymax/msmtpd:latest Up librenms_dispatcher librenms/librenms:latest Up
ℹ  Wait until the librenms logs show the migration finishing before opening the UI. Hitting the page mid-migration can show a blank or error screen — it resolves once startup completes.
06 — Create the Admin User

Unlike many appliances, LibreNMS has no default password. The first time you open the web UI it walks you through creating the administrator account. Browse to your server on port 8000 and append the install path:

First-run wizard
http://your-server-ip:8000/install/user

Provide a username, a strong password, and an email address, then finish the wizard. You are redirected to the login page, and from there to the validation screen that confirms the database, schema, and services are healthy.

✓  Lost access later? Create another admin from the CLI: docker compose exec librenms lnms user:add -r admin <username>
⚠  Because there are no default credentials, the account you create in this step is the only thing standing between the internet and full control of your monitoring data. Pick a strong password and do not expose port 8000 publicly without a reverse proxy and TLS in front of it.
07 — Prepare a Device for Monitoring

LibreNMS polls devices over SNMP. On each device you want to monitor, install and configure an SNMP agent. On a Linux target, the project ships a ready-made config — install snmpd, drop in the example file, and set your community string to match LIBRENMS_SNMP_COMMUNITY.

On the monitored Linux host
sudo apt install -y snmpd sudo mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.old sudo curl -o /etc/snmp/snmpd.conf \ https://raw.githubusercontent.com/librenms/librenms/master/snmpd.conf.example

Open the file and replace RANDOMSTRINGGOESHERE with your community string (the Docker default is librenmsdocker), then update the syslocation and syscontact lines. Restart the agent:

sudo systemctl restart snmpd
ℹ  For network gear (switches, routers, firewalls), enable SNMP in the device's own management interface instead — set a read-only community or SNMPv3 credentials and allow the LibreNMS host's IP.
08 — Add the Device

With SNMP answering, add the device in the UI under Devices → Add Device. Enter the hostname or IP, choose the SNMP version, and supply the community string. LibreNMS auto-detects the OS and begins discovery and polling. You can also do it from the CLI:

Add a device from the CLI
docker compose exec librenms lnms device:add \ 192.0.2.10 -c librenmsdocker
Force an immediate discovery & poll
docker compose exec librenms lnms device:poll 192.0.2.10

Graphs populate after a few polling cycles (every five minutes by default). The dispatcher sidecar handles scheduling, so no host cron job is required.

09 — Key Commands
TaskCommand
Start stackdocker compose up -d
Stop stackdocker compose down
View logs (live)docker compose logs -f librenms
Check statusdocker compose ps
Run validationdocker compose exec librenms php validate.php
Add admin userdocker compose exec librenms lnms user:add -r admin <name>
Set a config valuedocker compose exec librenms lnms config:set <key> <value>
Upgradedocker compose down && docker compose pull && docker compose up -d