--- id: docker title: With Docker description: How to use configure and deploy Supabase. --- Docker is the easiest way to get started with self-hosted Supabase. ## Before you begin You need the following installed in your system: - [Docker](https://docs.docker.com/engine/install/) and docker-compose - [Git](https://git-scm.com/downloads) ## Getting started ### Get the code Checkout the docker directory in the Supabase repo: ```sh git clone --depth 1 https://github.com/supabase/supabase cd supabase/docker ``` ### Manage Secrets Copy `.env.example` to `.env` and populate the values. ```sh cp .env.example .env ``` In particular, these are required: - `POSTGRES_PASSWORD`: the password for the `postgres` role - `JWT_SECRET`: used by PostgREST and GoTrue, among others - `SITE_URL`: the base URL of your site - `SMTP_*`: mail server credentials ### Generate API Keys Use your `JWT_SECRET` to generate a `anon` and `service` API keys using the [JWT generator](/docs/guides/hosting/overview#api-keys). Replace the values in these files: - `docker-compose.yml`: - `ANON_KEY` - replace with an `anon` key - `SERVICE_KEY` - replace with a `service` key - `volumes/kong.yml` - `anon` - replace with an `anon` key - `service_role` - replace with a `service` key ### Start You can now start Supabase: ```sh docker-compose up ``` Your database will be persisted in `volumes/db/data`, and your storage objects in `volumes/storage`. Try out the examples in `supabase/examples` to verify if it works correctly! ## Configuration To keep the setup simple, we made some choices that may not be optimal for production: - the database is in the same machine as the servers - the storage uses the filesystem backend instead of S3 We strongly [recommend](/docs/guides/hosting/overview#managing-your-database) that you decouple your database before deploying. Each system can be [configured](/docs/guides/hosting/overview#configuration) to suit your particular use-case. ## Deploying See the following guides to deploy Docker Compose setup using your preferred tool and platform: - [Docker Swarm](https://docs.docker.com/engine/swarm/stack-deploy/) - [AWS Fargate](https://aws.amazon.com/blogs/containers/deploy-applications-on-amazon-ecs-using-docker-compose/) - [Using Kompose for Kubernetes](https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/) ## Next steps - Got a question? [Ask here](https://github.com/supabase/supabase/discussions). - Sign in: [app.supabase.com](https://app.supabase.com)