Self-Hosting OwnTracks Recorder with Docker
What Is OwnTracks?
OwnTracks is a privacy-focused location tracking system. Your phone sends GPS coordinates to your own server via MQTT or HTTP — no third-party cloud involved. OwnTracks Recorder stores and visualizes your location history on a map, with support for geofencing, friends tracking, and waypoint alerts. It replaces Google Maps Timeline, Life360, and Apple’s location sharing with something you fully control.
Official site: owntracks.org | GitHub
How It Works
The OwnTracks ecosystem has three components:
- Mobile app (iOS/Android) — sends GPS coordinates at configurable intervals
- MQTT broker (Mosquitto) — receives and routes location messages
- OwnTracks Recorder — stores locations, serves the web UI and API
The phone publishes location data to an MQTT topic. The Recorder subscribes to that topic, stores data in LMDB, and serves a map-based web interface.
Docker Compose Configuration
services:
mosquitto:
image: eclipse-mosquitto:2.1.2
container_name: owntracks-mosquitto
restart: unless-stopped
ports:
- "1883:1883"
- "8883:8883"
volumes:
- ./mosquitto/config:/mosquitto/config
- mosquitto-data:/mosquitto/data
- mosquitto-log:/mosquitto/log
networks:
- owntracks-net
recorder:
image: owntracks/recorder:1.0.1
container_name: owntracks-recorder
restart: unless-stopped
ports:
- "8083:8083"
environment:
- OTR_HOST=mosquitto
- OTR_PORT=1883
- OTR_USER=owntracks
- OTR_PASS=changeme_mqtt
- OTR_HTTPHOST=0.0.0.0
- OTR_HTTPPORT=8083
depends_on:
- mosquitto
volumes:
- recorder-store:/store
networks:
- owntracks-net
volumes:
mosquitto-data:
mosquitto-log:
recorder-store:
networks:
owntracks-net:
Mosquitto Configuration
Create the Mosquitto config directory and files:
mkdir -p mosquitto/config
Create mosquitto/config/mosquitto.conf:
listener 1883
allow_anonymous false
password_file /mosquitto/config/password_file
persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
Create an MQTT user for OwnTracks:
docker compose run --rm mosquitto mosquitto_passwd -c /mosquitto/config/password_file owntracks
Enter the password when prompted (use the same value as OTR_PASS above).
Start the stack:
docker compose up -d
Initialize the Recorder’s LMDB database:
docker compose exec recorder ot-recorder --initialize
Prerequisites
- A Linux server (Ubuntu 22.04+ recommended)
- Docker and Docker Compose installed (guide)
- 1 GB of free disk space
- 512 MB of RAM minimum
- OwnTracks mobile app (iOS / Android)
- A domain name recommended (for secure remote access)
Mobile App Setup
-
Install the OwnTracks app on your phone
-
Open Settings → Connection:
- Mode: MQTT
- Host: your server’s IP or domain
- Port: 1883 (or 8883 for TLS)
- Username: owntracks (or whatever you configured)
- Password: your MQTT password
- Device ID: your-phone (identifies this device)
- Tracker ID: a 2-character identifier shown on the map
-
The app starts sending locations immediately. Check the Recorder web UI at
http://your-server:8083to see your position appear on the map.
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
OTR_HOST | localhost | MQTT broker hostname |
OTR_PORT | 1883 | MQTT broker port (set to 0 to disable MQTT) |
OTR_USER | — | MQTT username |
OTR_PASS | — | MQTT password |
OTR_HTTPHOST | localhost | Web UI bind address (set to 0.0.0.0 for Docker) |
OTR_HTTPPORT | 8083 | Web UI port |
OTR_STORAGEDIR | /store | Data storage directory |
OTR_PRECISION | 7 | Geohash precision for reverse geocoding |
OTR_GEOKEY | — | API key for OpenCage or Google reverse geocoding |
OTR_BROWSERAPIKEY | — | Google Maps browser API key (for map tiles) |
OTR_CAFILE | — | TLS CA certificate path |
OTR_LMDBSIZE | 5368709120 | Maximum LMDB database size (5 GB default) |
Reverse Geocoding
To show street addresses instead of coordinates, set OTR_GEOKEY to an OpenCage API key (2,500 free requests/day) or a Google Geocoding API key.
TLS Encryption
For secure MQTT over the internet, configure TLS on Mosquitto. Add to mosquitto.conf:
listener 8883
certfile /mosquitto/config/cert.pem
keyfile /mosquitto/config/key.pem
cafile /mosquitto/config/ca.pem
Set OTR_CAFILE on the Recorder to the same CA certificate.
Reverse Proxy
The web UI listens on port 8083. For HTTPS access through a reverse proxy, see Reverse Proxy Setup.
Important: OwnTracks Recorder’s “Friends” feature can be difficult to configure behind a reverse proxy. The official documentation recommends direct MQTT connections for multi-user setups.
Backup
Back up the recorder-store volume — it contains all location history in LMDB format:
docker compose exec recorder tar czf /tmp/store-backup.tar.gz /store
docker compose cp recorder:/tmp/store-backup.tar.gz ./owntracks-backup-$(date +%Y%m%d).tar.gz
Also back up mosquitto/config/ for your MQTT credentials.
For a full backup strategy, see Backup Strategy.
Troubleshooting
No Locations Appearing on the Map
Symptom: App says “connected” but the web UI shows nothing.
Fix: Check MQTT connectivity:
docker compose logs mosquitto | tail -20
Verify the app is publishing to the correct topic (owntracks/username/device). Check that the Recorder’s OTR_USER and OTR_PASS match the Mosquitto credentials.
”Connection Refused” from Mobile App
Symptom: App shows “connecting” but never succeeds.
Fix: Ensure port 1883 is open on your firewall. If connecting over the internet, use port 8883 with TLS — many ISPs block unencrypted MQTT traffic.
Map Shows No Tiles
Symptom: Location points appear but the map background is blank.
Fix: The default map uses OpenStreetMap tiles, which should work without configuration. If you’re using Google Maps tiles, set OTR_BROWSERAPIKEY to a valid Google Maps JavaScript API key.
LMDB Database Full
Symptom: “MDB_MAP_FULL” error in logs.
Fix: Increase OTR_LMDBSIZE in your environment variables. The default 5 GB handles years of location data for a single user.
Resource Requirements
- RAM: ~50 MB idle (very lightweight — LMDB is memory-mapped)
- CPU: Minimal — only processes incoming MQTT messages
- Disk: ~1 MB per year per user (location points are small)
Verdict
OwnTracks is the gold standard for self-hosted location tracking. It’s lightweight, reliable, and genuinely private — your GPS data never leaves your server. The MQTT architecture is elegant but adds setup complexity compared to HTTP-only solutions. If you want family location sharing without Life360’s surveillance capitalism, OwnTracks delivers. The main limitation is the web UI — it’s functional but bare-bones compared to Google Timeline’s polish. For a simpler HTTP-only tracker, consider Traccar.
Frequently Asked Questions
Does OwnTracks drain my phone battery?
Battery impact is minimal with default settings. OwnTracks uses the phone’s built-in location services, which are already running for other apps. On iOS, it uses significant location changes (cell tower switches) by default, which uses almost no extra battery. On Android, you can configure the reporting interval — every 30 minutes or on significant movement is typical. Frequent reporting (every 60 seconds) does increase battery drain.
Can I track family members with OwnTracks?
Yes. The “Friends” feature lets multiple users share locations. Each family member installs the OwnTracks app and connects to the same MQTT broker with a unique username. The Recorder shows all users on the same map. Each user can see the others’ current and historical positions. Disable sharing per-user by configuring MQTT ACLs on the Mosquitto broker.
Does OwnTracks work without an internet connection?
The app records location points locally when offline and publishes them to the MQTT broker when connectivity returns. However, the map UI in the Recorder requires an internet connection to load map tiles from OpenStreetMap. You can configure offline map tiles if you need a fully air-gapped setup, though this is uncommon.
How accurate is the location tracking?
Accuracy depends on your phone’s GPS hardware and environment. Outdoors with clear sky, expect 3-10 meter accuracy. Indoors or in urban canyons, accuracy drops to 20-100 meters as the phone falls back to Wi-Fi and cell tower triangulation. OwnTracks reports whatever accuracy the phone’s OS provides — it does not improve or degrade the raw GPS data.
Can I use OwnTracks with Home Assistant?
Yes. Home Assistant has a native OwnTracks integration that reads location data from the same MQTT broker. It creates device_tracker entities for each OwnTracks user, enabling presence-based automations — turn on lights when you arrive home, arm the alarm when everyone leaves, send a notification when a family member reaches school.
Is OwnTracks better than Traccar?
They solve different problems. OwnTracks is simpler and privacy-focused — your phone reports its own location via MQTT. Traccar is a fleet-tracking platform designed for GPS hardware trackers (OBD devices, dedicated trackers) and supports hundreds of protocols. For personal/family location sharing, OwnTracks is simpler. For vehicle or asset tracking with dedicated hardware, Traccar is more capable.
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments