MeshWorld India LogoMeshWorld.
HowToSupabaseDockerPostgreSQLLinuxSelf-Hosting6 min read

How to Self-Host Supabase with Docker Compose on Ubuntu (2026)

Vishnu
By Vishnu
·
Vishnu
Updated by Vishnu
|Updated: Jul 24, 2026
How to Self-Host Supabase with Docker Compose on Ubuntu (2026)

Supabase is the leading open-source Firebase alternative, providing a full backend-as-a-service (BaaS) stack built on PostgreSQL. A complete Supabase deployment combines PostgreSQL database storage, Kong API Gateway, GoTrue authentication, PostgREST automatic REST APIs, Realtime WebSockets, Storage bucket services, Vector embeddings, and the web-based Supabase Studio UI.

While Supabase offers a managed cloud service, self-hosting Supabase on Ubuntu 24.04 LTS (Noble Numbat) or 22.04 LTS (Jammy Jellyfish) using Docker Compose gives developers 100% data sovereignty, zero API usage caps, and complete control over database extensions.

Last updated: July 24, 2026

Key Takeaways

  • Self-hosting Supabase requires Docker Engine and the Docker Compose V2 plugin (`docker compose`).
  • The official Supabase repository provides a production-ready `docker-compose.yml` file under the `docker/` directory.
  • Never deploy Supabase with default secrets: you must generate unique values for `POSTGRES_PASSWORD`, `JWT_SECRET`, `ANON_KEY`, and `SERVICE_ROLE_KEY` in your `.env` file.
  • Once running, Supabase Studio web dashboard is accessible on port `8000`, and Kong API Gateway exposes REST and Auth APIs on port `8000`.

What are the system requirements for self-hosting Supabase?

Self-hosting the complete Supabase Docker stack requires a 64-bit Linux server running Ubuntu 24.04 or 22.04 LTS with at least 4 GB RAM, 2 CPU cores, 10 GB disk space, and Docker Engine 24.0+ with Docker Compose V2 installed.

Running the multi-container Supabase stack requires sufficient memory and CPU resources:

  • Operating System: Ubuntu 24.04 LTS, 22.04 LTS, or Debian 12
  • Memory: Minimum 4 GB RAM (8 GB+ recommended for production database caching)
  • CPU: 2 or more CPU cores
  • Disk Space: 10 GB available SSD storage for Docker container images and database volumes
  • Prerequisites: Docker Engine 24.0+ and Docker Compose V2 installed

How do you install Docker and Docker Compose on Ubuntu?

To install Docker Engine and the Docker Compose V2 plugin on Ubuntu, import the official Docker GPG repository keyring and install docker-ce along with docker-compose-plugin using the apt package manager.

If Docker is not already installed on your Ubuntu server:

bash
sudo apt update
sudo apt install -y ca-certificates curl gnupg

# Add official Docker GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add Docker repository to APT sources
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list

# Install Docker Engine and Compose Plugin
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Add user to docker group
sudo usermod -aG docker $USER

Verify Docker installation:

bash
docker compose version

How do you set up Supabase using Docker Compose?

To set up self-hosted Supabase using Docker Compose, clone the official Supabase repository, enter the docker directory, create a .env configuration file, and generate secure database passwords and JWT secrets.

Follow these steps to clone the official Supabase setup repository and configure environment variables.

Step 1: Clone the Official Supabase Repository

Clone the Supabase repository and navigate to the docker configuration folder:

bash
# Clone the repository with shallow depth
git clone --depth 1 https://github.com/supabase/supabase

# Navigate to docker folder
cd supabase/docker

Step 2: Copy the Environment Template File

Create your local .env configuration file from the template:

bash
cp .env.example .env

Step 3: Generate Secure JWT Secrets and Database Passwords

Before starting containers, you MUST update default passwords and cryptographic keys.

  1. Generate a strong random password for PostgreSQL:

    bash
    openssl rand -base64 24

    Edit .env and set POSTGRES_PASSWORD to this generated password.

  2. Generate a secure 32-character random string for your JWT secret:

    bash
    openssl rand -base64 32

    Edit .env and update JWT_SECRET with this string.

  3. Generate valid ANON_KEY and SERVICE_ROLE_KEY API tokens corresponding to your new JWT_SECRET using a JWT signing tool or jwt.io, or set up automated key generation as documented in .env.


How do you start and verify Supabase services?

To start and verify self-hosted Supabase services, execute docker compose up -d inside your supabase/docker directory and verify container health status using docker compose ps.

Once your .env file is configured, launch the container stack using Docker Compose:

Step 1: Start Supabase Containers in Detached Mode

bash
docker compose up -d

Step 2: Check Container Health Status

Verify that all Supabase microservices are active and healthy:

bash
docker compose ps

Expected running services:

  • supabase-db (PostgreSQL 15/16 with pgvector extension)
  • supabase-kong (API Gateway)
  • supabase-auth (GoTrue Authentication service)
  • supabase-rest (PostgREST API server)
  • supabase-realtime (WebSockets server)
  • supabase-storage (S3-compatible Object Storage)
  • supabase-meta (Database Management Metadata API)
  • supabase-studio (Dashboard Web UI)

How do you access Supabase Studio Dashboard?

To access the web-based Supabase Studio Dashboard, open your web browser and navigate to http://<your-server-ip>:8000, which routes administrative UI traffic through the Kong API Gateway container.

Open your web browser and navigate to your server’s IP address or hostname on port 8000:

text
http://<your-server-ip>:8000

From the Supabase Studio Dashboard, you can:

  • Create database tables, view schemas, and run raw SQL queries.
  • Manage authentication users, email templates, and OAuth providers.
  • Configure public and private storage buckets.
  • Monitor database logs and REST/GraphQL API endpoints.

Security Warning: Production Firewall Rules

In production environments, restrict external access to ports 5432 (Postgres) and 8000 (Studio UI) using UFW firewall rules. Use NGINX or Caddy as a reverse proxy to terminate SSL/TLS certificates and enforce HTTPS over port 443.


Frequently Asked Questions (PAA)

Is self-hosted Supabase completely free?

Yes. The self-hosted Supabase Docker stack is 100% free and open-source under Apache 2.0 and MIT licenses. There are no row limits, bandwidth caps, or user quotas.

What is the default port for Supabase Studio and API Gateway?

Supabase Studio dashboard and Kong API Gateway both run through Kong on port 8000. The raw PostgreSQL database is exposed on port 5432.

How do I update self-hosted Supabase to the latest version?

Navigate to your supabase/docker directory, pull the latest git changes, pull updated Docker images, and restart:

bash
cd supabase/docker
git pull
docker compose pull
docker compose up -d

How do I stop or restart the self-hosted Supabase stack?

To stop all services:

bash
docker compose down

To restart all services:

bash
docker compose restart

Share_This Twitter / X
Vishnu
Written By

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Vishnu
Updated By

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Enjoyed this article?

Support MeshWorld and help us create more technical content