docker.recipes

Apache Superset BI Platform

intermediate

Modern data exploration and visualization platform with SQL IDE.

Overview

Apache Superset is a modern data exploration and visualization platform originally developed by Airbnb and later open-sourced under the Apache Software Foundation. It provides a rich web interface for creating interactive dashboards, exploring datasets through SQL Lab, and building complex visualizations without requiring extensive programming knowledge. Superset supports dozens of databases and data sources, making it a versatile business intelligence solution for organizations of all sizes. This stack combines Superset with PostgreSQL as the metadata database, Redis for caching and session storage, and Celery workers for handling asynchronous tasks like report generation and alert processing. PostgreSQL stores Superset's configuration, user permissions, and dashboard metadata, while Redis accelerates chart rendering and manages user sessions. The Celery worker processes background jobs, preventing long-running queries or report exports from blocking the main web interface. Data teams, analysts, and organizations seeking to democratize data access should consider this configuration. The combination provides enterprise-grade performance with Redis caching reducing dashboard load times, PostgreSQL ensuring data integrity for user management and metadata, and Celery workers enabling scalable report generation. This setup is particularly valuable for teams transitioning from expensive commercial BI tools or those needing a self-hosted alternative to cloud-based analytics platforms.

Key Features

  • SQL Lab IDE with syntax highlighting, query history, and result export capabilities
  • Drag-and-drop dashboard builder with 50+ visualization types including maps and time-series charts
  • Native database connectivity to PostgreSQL, MySQL, SQLite, and 30+ other data sources
  • Redis-powered chart caching reducing dashboard load times by up to 80%
  • Celery task queue for background report generation and scheduled dashboard exports
  • Row-level security and column-level permissions using PostgreSQL's robust access control
  • Real-time dashboard updates with WebSocket support and automatic refresh intervals
  • Jinja templating in SQL queries for dynamic filtering and parameterized reports

Common Use Cases

  • 1Business intelligence dashboards for sales, marketing, and operations teams
  • 2Self-service analytics platform for non-technical users to explore company data
  • 3Data exploration and visualization for data science teams working with large datasets
  • 4Embedded analytics in SaaS applications using Superset's REST API and iframe embedding
  • 5Real-time monitoring dashboards for application metrics and KPIs
  • 6Financial reporting and compliance dashboards with scheduled PDF exports
  • 7Customer-facing analytics portals with white-label customization options

Prerequisites

  • Docker and Docker Compose installed with at least 4GB RAM available for the stack
  • Port 8088 available for Superset web interface access
  • Basic SQL knowledge for creating queries and connecting to data sources
  • Environment variables configured: SUPERSET_SECRET_KEY, POSTGRES credentials, ADMIN_PASSWORD
  • Understanding of your target databases and their connection parameters
  • Familiarity with business intelligence concepts like dimensions, measures, and filters

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 superset:
3 image: apache/superset:latest
4 ports:
5 - "8088:8088"
6 environment:
7 SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
8 SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
9 REDIS_HOST: redis
10 REDIS_PORT: 6379
11 volumes:
12 - superset_home:/app/superset_home
13 depends_on:
14 postgres:
15 condition: service_healthy
16 redis:
17 condition: service_started
18 networks:
19 - superset-net
20 restart: unless-stopped
21 command: >
22 bash -c "superset db upgrade &&
23 superset fab create-admin --username admin --firstname Admin --lastname User --email admin@example.com --password ${ADMIN_PASSWORD} || true &&
24 superset init &&
25 gunicorn --bind 0.0.0.0: 8088 --workers 4 'superset.app:create_app()'"
26
27 superset-worker:
28 image: apache/superset:latest
29 environment:
30 SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
31 SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
32 REDIS_HOST: redis
33 REDIS_PORT: 6379
34 volumes:
35 - superset_home:/app/superset_home
36 depends_on:
37 - superset
38 command: celery --app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4
39 networks:
40 - superset-net
41 restart: unless-stopped
42
43 postgres:
44 image: postgres:16-alpine
45 environment:
46 POSTGRES_USER: ${POSTGRES_USER}
47 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
48 POSTGRES_DB: ${POSTGRES_DB}
49 volumes:
50 - postgres_data:/var/lib/postgresql/data
51 healthcheck:
52 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
53 interval: 10s
54 timeout: 5s
55 retries: 5
56 networks:
57 - superset-net
58 restart: unless-stopped
59
60 redis:
61 image: redis:7-alpine
62 volumes:
63 - redis_data:/data
64 networks:
65 - superset-net
66 restart: unless-stopped
67
68volumes:
69 superset_home:
70 postgres_data:
71 redis_data:
72
73networks:
74 superset-net:
75 driver: bridge

.env Template

.env
1# Superset Configuration
2SUPERSET_SECRET_KEY=$(openssl rand -base64 42)
3ADMIN_PASSWORD=secure_admin_password
4
5# PostgreSQL
6POSTGRES_USER=superset
7POSTGRES_PASSWORD=secure_postgres_password
8POSTGRES_DB=superset

Usage Notes

  1. 1Superset at http://localhost:8088
  2. 2Login with admin account created on startup
  3. 3Connect to your databases via SQL Lab
  4. 4Create dashboards and visualizations

Individual Services(4 services)

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

superset
superset:
  image: apache/superset:latest
  ports:
    - "8088:8088"
  environment:
    SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
    SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
    REDIS_HOST: redis
    REDIS_PORT: 6379
  volumes:
    - superset_home:/app/superset_home
  depends_on:
    postgres:
      condition: service_healthy
    redis:
      condition: service_started
  networks:
    - superset-net
  restart: unless-stopped
  command: |
    bash -c "superset db upgrade &&
             superset fab create-admin --username admin --firstname Admin --lastname User --email admin@example.com --password ${ADMIN_PASSWORD} || true &&
             superset init &&
             gunicorn --bind 0.0.0.0:8088 --workers 4 'superset.app:create_app()'"
superset-worker
superset-worker:
  image: apache/superset:latest
  environment:
    SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
    SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
    REDIS_HOST: redis
    REDIS_PORT: 6379
  volumes:
    - superset_home:/app/superset_home
  depends_on:
    - superset
  command: celery --app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4
  networks:
    - superset-net
  restart: unless-stopped
postgres
postgres:
  image: postgres:16-alpine
  environment:
    POSTGRES_USER: ${POSTGRES_USER}
    POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    POSTGRES_DB: ${POSTGRES_DB}
  volumes:
    - postgres_data:/var/lib/postgresql/data
  healthcheck:
    test:
      - CMD-SHELL
      - pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}
    interval: 10s
    timeout: 5s
    retries: 5
  networks:
    - superset-net
  restart: unless-stopped
redis
redis:
  image: redis:7-alpine
  volumes:
    - redis_data:/data
  networks:
    - superset-net
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 superset:
5 image: apache/superset:latest
6 ports:
7 - "8088:8088"
8 environment:
9 SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
10 SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
11 REDIS_HOST: redis
12 REDIS_PORT: 6379
13 volumes:
14 - superset_home:/app/superset_home
15 depends_on:
16 postgres:
17 condition: service_healthy
18 redis:
19 condition: service_started
20 networks:
21 - superset-net
22 restart: unless-stopped
23 command: >
24 bash -c "superset db upgrade &&
25 superset fab create-admin --username admin --firstname Admin --lastname User --email admin@example.com --password ${ADMIN_PASSWORD} || true &&
26 superset init &&
27 gunicorn --bind 0.0.0.0:8088 --workers 4 'superset.app:create_app()'"
28
29 superset-worker:
30 image: apache/superset:latest
31 environment:
32 SUPERSET_SECRET_KEY: ${SUPERSET_SECRET_KEY}
33 SQLALCHEMY_DATABASE_URI: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
34 REDIS_HOST: redis
35 REDIS_PORT: 6379
36 volumes:
37 - superset_home:/app/superset_home
38 depends_on:
39 - superset
40 command: celery --app=superset.tasks.celery_app:app worker --pool=prefork -O fair -c 4
41 networks:
42 - superset-net
43 restart: unless-stopped
44
45 postgres:
46 image: postgres:16-alpine
47 environment:
48 POSTGRES_USER: ${POSTGRES_USER}
49 POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
50 POSTGRES_DB: ${POSTGRES_DB}
51 volumes:
52 - postgres_data:/var/lib/postgresql/data
53 healthcheck:
54 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
55 interval: 10s
56 timeout: 5s
57 retries: 5
58 networks:
59 - superset-net
60 restart: unless-stopped
61
62 redis:
63 image: redis:7-alpine
64 volumes:
65 - redis_data:/data
66 networks:
67 - superset-net
68 restart: unless-stopped
69
70volumes:
71 superset_home:
72 postgres_data:
73 redis_data:
74
75networks:
76 superset-net:
77 driver: bridge
78EOF
79
80# 2. Create the .env file
81cat > .env << 'EOF'
82# Superset Configuration
83SUPERSET_SECRET_KEY=$(openssl rand -base64 42)
84ADMIN_PASSWORD=secure_admin_password
85
86# PostgreSQL
87POSTGRES_USER=superset
88POSTGRES_PASSWORD=secure_postgres_password
89POSTGRES_DB=superset
90EOF
91
92# 3. Start the services
93docker compose up -d
94
95# 4. View logs
96docker 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/apache-superset/run | bash

Troubleshooting

  • Superset fails to start with 'cannot connect to database': Verify PostgreSQL container is healthy and SQLALCHEMY_DATABASE_URI environment variable is correct
  • Dashboard charts load slowly or timeout: Check Redis container status and increase Celery worker count by modifying the '-c 4' parameter
  • Permission denied when creating datasets: Ensure admin user was created successfully and check superset-worker container logs for Celery task failures
  • 'Secret key not found' error: Generate a strong SUPERSET_SECRET_KEY using 'openssl rand -base64 42' and add to environment variables
  • Database connection test fails in SQL Lab: Verify database driver compatibility and check if target database allows connections from Docker network IP range
  • Charts show 'No data' despite successful queries: Clear Redis cache by restarting redis container and check for timezone mismatches in date fields

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