How to Install Supabase on Ubuntu 24.04 with Docker Compose

How to Install Supabase on Ubuntu 24.04 with Docker Compose

This article walks through a basic self-hosted Supabase installation on Ubuntu 24.04 using Docker Compose.

Prerequisites

This guide assumes you are using an Ubuntu 24.04 host. In this example, the host is a virtual machine.

Docker Compose is required. To verify that it is installed, run this command:

docker compose version

Git is required. To verify that it is installed, run this command:

git --version

Step 1: Set Up Supabase Deployment Files

Clone the Supabase Repository

Clone the Supabase repository into your home directory:

git clone --depth 1 https://github.com/supabase/supabase

Create a Supabase Project Directory

Create a separate directory for your self-hosted Supabase deployment files:

mkdir ~/supabase-project

Your directory layout should now look like this:

/home/username/
├── supabase/          # cloned Supabase repository
└── supabase-project/  # self-hosted Supabase deployment files

Copy the Docker Compose Files into the Project Directory

cp -rf ~/supabase/docker/* ~/supabase-project

Copy the Example Environment File

cp ~/supabase/docker/.env.example ~/supabase-project/.env

Change to the Project Directory and Pull the Latest Images

cd ~/supabase-project
docker compose pull

Step 2: Start Supabase and Verify Operation

At this stage, the goal is to start Supabase with the default configuration and confirm that the stack is working before changing credentials.

Change to the Deployment Directory

cd ~/supabase-project

Start the Stack

docker compose up -d

Check the Running Docker Containers

docker compose ps

You should see multiple Supabase-related containers, with the Status column showing healthy for the services that provide health checks.


Step 3: Replace Default Credentials and Secrets

Important: Do not leave the default credentials and secrets in place, especially if the service is reachable from any other machine on your network.

Shut Down the Running Docker Containers

docker compose down

Edit the Environment File and Replace the Defaults

Update the following values in your .env file:

  • POSTGRES_PASSWORD
  • JWT_SECRET
  • ANON_KEY
  • SERVICE_ROLE_KEY
  • DASHBOARD_USERNAME
  • DASHBOARD_PASSWORD

Supabase includes a utility script that can generate replacement values for several of these secrets at once.

Run the following from the project directory:

cd ~/supabase-project
sh ./utils/generate-keys.sh

The generated values will be displayed in the terminal. You can also review the updated values in the .env file located at:

~/supabase-project/.env

Store these values in a secure location, such as a password manager or secure documentation vault.

Start Supabase Again

docker compose up -d

Step 4: Open Supabase Studio

Open Supabase Studio in a browser:

http://<your-vm-ip>:8000

If the deployment is working correctly, the Studio interface should load and prompt you to sign in with the dashboard credentials you configured.


Notes

  • This guide covers a basic self-hosted Supabase installation for lab or internal use.
  • Additional hardening may be appropriate before exposing the service beyond a trusted network.
  • Consider follow-up tasks such as HTTPS, reverse proxy configuration, DNS, firewall rules, and backup planning.