Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

How to Install Supabase with Docker on Ubuntu 24.04

How to Install Supabase with Docker on Ubuntu 24.04

Setting up Supabase with Docker on Ubuntu 24.04 provides a streamlined way to deploy a powerful backend platform locally or on your server. This approach simplifies installation, isolates dependencies, and makes your environment portable and easy to manage. Whether you’re developing an app, testing features, or just exploring Supabase’s capabilities, running it via Docker ensures a consistent setup that can be easily updated or removed. Before you begin, ensure your Ubuntu system is up to date and has Docker installed. This guide will walk you through each step to get Supabase running smoothly on your Ubuntu 24.04 machine.

What You’ll Need

  • Ubuntu 24.04 installed and running
  • Root or sudo privileges on the system
  • Docker installed and configured (Docker Engine)
  • Docker Compose installed
  • Basic knowledge of terminal commands

Step-by-Step

  1. Update Your System: Ensure your Ubuntu system is current. Open a terminal and run:
    sudo apt update && sudo apt upgrade -y
  2. Install Docker: If Docker isn’t installed, install it with the following commands:
    sudo apt install docker.io -y
    sudo systemctl enable --now docker

    Verify the installation:

    docker --version
  3. Install Docker Compose: Download the latest Docker Compose binary:
    sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

    Set execute permissions:

    sudo chmod +x /usr/local/bin/docker-compose

    Verify installation:

    docker-compose --version
  4. Create a Directory for Supabase: Make a dedicated folder to hold your Docker setup files:
    mkdir ~/supabase-docker
    cd ~/supabase-docker
  5. Download the Supabase Docker Compose File: Create a docker-compose.yml file with the official Supabase configuration. You can use the following sample:
    nano docker-compose.yml

    Paste the following content:

    version: '3.8'
    services:
      db:
        image: postgres:15
        restart: always
        environment:
          POSTGRES_PASSWORD: supersecret
        volumes:
          - db-data:/var/lib/postgresql/data
    
      api:
        image: supabase/postgrest
        restart: always
        environment:
          PGRST_DB_URI: postgres://postgres:supersecret@db:5432/postgres
        depends_on:
          - db
    
      studio:
        image: supabase/studio
        restart: always
        environment:
          SUPABASE_URL: http://localhost:3000
        ports:
          - "8080:8080"
        depends_on:
          - api
    
    volumes:
      db-data:
        driver: local

    Save and exit the file (CTRL+O, ENTER, CTRL+X).

  6. Launch Supabase with Docker Compose: Run the following command in your project directory:
    docker-compose up -d

    This command pulls the necessary images and starts all services in detached mode. It may take a few minutes to initialize fully.

  7. Verify the Installation: Check if containers are running:
    docker ps

    You should see containers for postgres, api, and studio. Access the Supabase Studio UI by navigating to http://localhost:8080 in your browser. Log in with default credentials or as configured.

Common Mistakes

  • Not updating the system before starting, leading to dependency issues.
  • Forgetting to set executable permissions on the Docker Compose file.
  • Using incorrect or outdated Docker images—always check for the latest versions.
  • Not exposing ports properly, which can prevent access to the Supabase Studio UI.
  • Misconfiguring environment variables or passwords, causing connection failures.

Tips

  • Use environment variables or a .env file to manage secrets securely.
  • Regularly update your Docker images for security and feature improvements:
  • docker-compose pull
  • Backup your volumes regularly, especially the database volume, to prevent data loss.
  • For production, consider setting up a reverse proxy and SSL termination for secure access.
  • Monitor your containers with Docker logs or tools like Portainer for better management.

Troubleshooting

If your setup does not go as planned, here are some common issues and solutions:

Containers Fail to Start

Check container logs for errors:

docker-compose logs

Ensure you have enough disk space and resources. If images fail to download, verify your internet connection and Docker daemon status.

Cannot Access Supabase Studio UI

Verify the container is running:

docker ps

Ensure port 8080 is open and not blocked by a firewall. You can test access locally or from another device if configured for remote access.

Database Connection Issues

Double-check environment variables such as POSTGRES_PASSWORD. Use psql or a database client to test the connection.
Ensure containers depend on each other properly and are started in the correct order.

Data Not Persisting

Ensure your volume mounts are correctly configured and persistent. Avoid deleting volumes unless you want to reset data.

Frequently Asked Questions

Is Docker necessary to run Supabase?

While not mandatory, Docker simplifies setup, provides environment isolation, and makes updates easier. You can install Supabase natively, but Docker is recommended for ease and portability.

Can I run Supabase on Windows or Mac?

Yes, using Docker Desktop on Windows or Mac, you can follow similar steps. Just ensure Docker is installed and configured properly on your platform.

How do I update Supabase to the latest version?

Pull the latest images with

docker-compose pull

and restart containers with

docker-compose up -d

.

Is it secure to run Supabase with Docker on my server?

Security depends on your configuration. Use strong passwords, keep your images updated, and consider setting up reverse proxies with SSL for secure access.

Can I customize the Supabase setup?

Yes, modify the docker-compose.yml file to add or change services, environment variables, or volumes according to your project needs.

What resources are needed to run Supabase?

At minimum, allocate sufficient CPU, RAM, and disk space based on your expected database size and workload. For small projects, a system with 2-4GB RAM is sufficient.

By following this guide, you can quickly deploy Supabase on Ubuntu 24.04 using Docker, giving you a robust backend platform for development or testing. Always remember to keep your setup secure, backed up, and up to date for the best experience.

Related

How to Install Supabase with Docker on Ubuntu 24.04
Scroll to top