DOKPLOY-GUIDE 6 min read fordnox

Deploy Grafana with Dokploy: Docker Compose Setup Guide

Step-by-step guide to deploying Grafana observability dashboards on your VPS using Dokploy and Docker Compose. Includes persistent storage, admin setup, and SSL.


Deploy Grafana with Dokploy

Dokploy is an open-source server management platform that simplifies deploying Docker Compose applications on your VPS. It handles reverse proxy configuration, SSL certificates, and deployment management — making it easy to get Grafana's powerful dashboards running in production.

This guide walks you through deploying Grafana with persistent dashboard storage, admin credentials, and automatic HTTPS. Grafana is a single-container application that stores its data in an embedded SQLite database by default.

Prerequisites

Docker Compose Configuration

Create a new Compose project in Dokploy and paste the following configuration:

version: "3.8"

services:
  grafana:
    image: grafana/grafana:latest
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_USER=${GF_ADMIN_USER:-admin}
      - GF_SECURITY_ADMIN_PASSWORD=${GF_ADMIN_PASSWORD}
      - GF_SERVER_ROOT_URL=https://${GRAFANA_DOMAIN}
      - GF_USERS_ALLOW_SIGN_UP=false
    volumes:
      - ../files/grafana-data:/var/lib/grafana
    healthcheck:
      test: ["CMD-SHELL", "wget --quiet --tries=1 --spider http://localhost:3000/api/health || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3

Note: Grafana uses an embedded SQLite database by default, which is stored in /var/lib/grafana. For larger deployments, you can configure an external PostgreSQL or MySQL database via additional GF_DATABASE_* environment variables.

Environment Variables

Set these in Dokploy's Environment tab for your compose project:

Variable Purpose Example
GRAFANA_DOMAIN Your Grafana domain name grafana.yourdomain.com
GF_ADMIN_USER Admin username (default: admin) admin
GF_ADMIN_PASSWORD Admin password a-strong-random-password

In Dokploy, environment variables are set via the Environment editor in the project settings. Do not create a .env file manually — Dokploy manages this for you. Additional Grafana settings follow the pattern GF_<SECTION>_<KEY> (e.g., GF_AUTH_ANONYMOUS_ENABLED=true).

Volumes & Data Persistence

This setup uses Dokploy's ../files convention for bind-mounted volumes:

The ../files path is relative to the compose file inside Dokploy's project directory. This ensures your data persists across redeployments. Avoid using absolute paths (e.g., /opt/grafana) because Dokploy may clean them during redeployment.

Important: The Grafana container runs as user grafana (UID 472). If you encounter permission errors, run chown -R 472:472 on the data directory from your server's shell.

If you need S3 backup support, consider using named Docker volumes instead. Named volumes can be backed up with Dokploy's built-in backup features.

Domain & SSL Setup

  1. In your Dokploy project, navigate to the Domains tab
  2. Click Add Domain and enter your domain (e.g., grafana.yourdomain.com)
  3. Set the container port to 3000
  4. Enable HTTPS — Dokploy automatically provisions a Let's Encrypt SSL certificate
  5. Save and wait for the certificate to be issued (usually under a minute)

Dokploy's built-in Traefik reverse proxy handles TLS termination and routes traffic to your Grafana container.

Verifying the Deployment

  1. In Dokploy, go to your project's Deployments tab and click Deploy
  2. Watch the build logs — you should see the grafana container pull and start
  3. Check the Logs tab for the grafana service. Look for: HTTP Server Listen
  4. Open https://grafana.yourdomain.com in your browser — you should see the Grafana login page
  5. Log in with your GF_ADMIN_USER and GF_ADMIN_PASSWORD credentials
  6. Add your first data source (Prometheus, InfluxDB, etc.) to verify connectivity

Troubleshooting

Grafana container exits with permission errors The Grafana image runs as UID 472. If the ../files/grafana-data directory was created by root, Grafana cannot write to it. Run chown -R 472:472 on the data directory from your server's shell, then redeploy.

Cannot log in with default credentials If you changed GF_ADMIN_PASSWORD after the first run, the password stored in the database takes precedence. Reset it by running grafana cli admin reset-admin-password <new-password> inside the container via Dokploy's terminal.

Dashboards disappear after redeployment Ensure the ../files/grafana-data volume is correctly mapped. Grafana stores dashboards in its database at /var/lib/grafana/grafana.db. If the volume is not persisted, all data is lost on container recreation.

SSL certificate not issuing Ensure your domain's DNS A record points to your server's IP and has propagated. Dokploy uses Let's Encrypt HTTP-01 challenges, so port 80 must be accessible. Check Traefik logs in Dokploy for certificate-related errors.


Learn more about Grafana in our complete overview.

Need a VPS? Hostinger VPS starts at $4.99/mo — perfect for running Grafana.


For more on Docker Compose deployments in Dokploy, see the Dokploy Docker Compose documentation.

App data sourced from selfh.st open-source directory.

~/self-hosted-app/grafana/dokploy/get-started

Ready to get started?

Get the best VPS hosting deal today. Hostinger offers 4GB RAM VPS starting at just $4.99/mo.

Get Hostinger VPS — $4.99/mo

// up to 75% off + free domain included

// related topics

grafana dokploy docker compose self-hosted observability dashboards grafana deployment

fordnox

Expert VPS reviews and hosting guides. We test every provider we recommend.

// last updated: February 12, 2026. Disclosure: This article may contain affiliate links.