Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

update: improve docker self hosting documentation (#27974)

Jasper0c4c874a6a0a
diff --git a/apps/docs/content/guides/self-hosting/docker.mdx b/apps/docs/content/guides/self-hosting/docker.mdx
index b66ea247ceb..088542a471c 100644
--- a/apps/docs/content/guides/self-hosting/docker.mdx
+++ b/apps/docs/content/guides/self-hosting/docker.mdx
@@ -1,8 +1,8 @@
---
-title: 'Self-Hosting with Docker'
-description: 'Learn how to configure and deploy Supabase with Docker.'
-subtitle: 'Learn how to configure and deploy Supabase with Docker.'
-tocVideo: 'FqiQKRKsfZE'
+title: "Self-Hosting with Docker"
+description: "Learn how to configure and deploy Supabase with Docker."
+subtitle: "Learn how to configure and deploy Supabase with Docker."
+tocVideo: "FqiQKRKsfZE"
---
Docker is the easiest way to get started with self-hosted Supabase. It should only take you a few minutes to get up and running. This guide assumes you are running the command from the machine you intend to host from.
@@ -24,22 +24,33 @@ You need the following installed in your system: [Git](https://git-scm.com/downl
Follow these steps to start Supabase on your machine:
<Tabs
- scrollable
- size="small"
- type="underlined"
- defaultActiveId="general"
->
-<TabPanel id="general" label="General">
+scrollable
+size="small"
+type="underlined"
+defaultActiveId="general"
+
+> <TabPanel id="general" label="General">
```sh
# Get the code
git clone --depth 1 https://github.com/supabase/supabase
-# Go to the docker folder
-cd supabase/docker
+# Make your new supabase project directory
+mkdir supabase-project
+
+# Tree should look like this
+# .
+# ├── supabase
+# └── supabase-project
+
+# Copy the compose files over to your project
+cp -rf supabase/docker/* supabase-project
# Copy the fake env vars
-cp .env.example .env
+cp supabase/docker/.env.example supabase-project/.env
+
+# Switch to your project directory
+cd supabase-project
# Pull the latest images
docker compose pull
@@ -56,12 +67,24 @@ docker compose up -d
git clone --filter=blob:none --no-checkout https://github.com/supabase/supabase
cd supabase
git sparse-checkout set --cone docker && git checkout master
+cd ..
+
+# Make your new supabase project directory
+mkdir supabase-project
+
+# Tree should look like this
+# .
+# ├── supabase
+# └── supabase-project
-# Go to the docker folder
-cd docker
+# Copy the compose files over to your project
+cp -rf supabase/docker/* supabase-project
# Copy the fake env vars
-cp .env.example .env
+cp supabase/docker/.env.example supabase-project/.env
+
+# Switch to your project directory
+cd supabase-project
# Pull the latest images
docker compose pull
@@ -142,6 +165,15 @@ The default tenant ID is `your-tenant-id`, and the default password is `your-sup
By default, the database is not accessible from outside the local machine but the pooler is. You can [change this](#exposing-your-postgres-database) by updating the `docker-compose.yml` file.
+You may also want to connect to your Postgres database via an ORM or another direct method other than `psql`.
+
+For this you can use the standard Postgres connection string.
+You can find the the environment values mentioned below in the `.env` file which will be covered in the next section.
+
+```
+postgres://postgres:[POSTGRES_PASSWORD]@[your-server-ip]:5432/[POSTGRES_DB]
+```
+
## Updating your services
For security reasons, we "pin" the versions of each service in the docker-compose file (these versions are updated ~monthly). If you want to update any services immediately, you can do so by updating the version number in the docker compose file and then running `docker compose pull`. You can find all the latest docker images in the [Supabase Docker Hub](https://hub.docker.com/u/supabase).
@@ -278,8 +310,8 @@ If the tool doesn't exist, we build and open source it ourselves.
<Image
alt="Diagram showing the architecture of Supabase. The Kong API gateway sits in front of 7 services: GoTrue, PostgREST, Realtime, Storage, pg_meta, Functions, and pg_graphql. All the services talk to a single Postgres instance."
src={{
- dark: '/docs/img/supabase-architecture.svg',
- light: '/docs/img/supabase-architecture--light.svg',
+ dark: "/docs/img/supabase-architecture.svg",
+ light: "/docs/img/supabase-architecture--light.svg",
}}
/>