こちらと同様のことを、Ubuntu 25.04 で行いました。
DockerでのSupabaseのローカル環境構築
使ったバージョン
$ docker compose version
Docker Compose version v2.34.0
docker-compose.yml
docker-compose.yml
services:
db:
image: supabase/postgres:15.8.1.060
container_name: supabase-db
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres", "-h", "localhost"]
interval: 5s
timeout: 5s
retries: 10
environment:
POSTGRES_PASSWORD: examplepass
POSTGRES_DB: postgres
volumes:
- ./volumes/db/data:/var/lib/postgresql/data:Z
restart: unless-stopped
meta:
image: supabase/postgres-meta:v0.89.0
container_name: supabase-meta
depends_on:
db:
condition: service_healthy
environment:
PG_META_PORT: 8080
PG_META_DB_HOST: db
PG_META_DB_PORT: 5432
PG_META_DB_NAME: postgres
PG_META_DB_USER: postgres
PG_META_DB_PASSWORD: examplepass
ports:
- "8080:8080"
restart: unless-stopped
rest:
image: postgrest/postgrest:v12.2.12
container_name: supabase-rest
depends_on:
db:
condition: service_healthy
environment:
PGRST_DB_URI: postgres://postgres:examplepass@db:5432/postgres
PGRST_DB_SCHEMAS: public
PGRST_DB_ANON_ROLE: anon
PGRST_JWT_SECRET: super-secret-jwt
ports:
- "3000:3000"
command: ["postgrest"]
restart: unless-stopped
auth:
image: supabase/gotrue:v2.172.1
container_name: supabase-auth
depends_on:
db:
condition: service_healthy
environment:
GOTRUE_API_HOST: 0.0.0.0
GOTRUE_API_PORT: 9999
API_EXTERNAL_URL: http://localhost:9999
GOTRUE_DB_DRIVER: postgres
GOTRUE_DB_DATABASE_URL: postgres://postgres:examplepass@db:5432/postgres
GOTRUE_SITE_URL: http://localhost:3000
GOTRUE_JWT_SECRET: super-secret-jwt
ports:
- "9999:9999"
restart: unless-stopped
studio:
image: supabase/studio:2025.05.19-sha-3487831
container_name: supabase-studio
depends_on:
db:
condition: service_healthy
meta:
condition: service_healthy
environment:
POSTGRES_PASSWORD: examplepass
SUPABASE_ANON_KEY: super-secret-anon
SUPABASE_SERVICE_KEY: super-secret-service
STUDIO_PG_META_URL: http://meta:8080
SUPABASE_URL: http://localhost:3000
SUPABASE_PUBLIC_URL: http://localhost:3000
AUTH_JWT_SECRET: super-secret-jwt
ports:
- "8081:3000"
restart: unless-stopped
インストールと起動
docker compose up
確認
ブラウザーで、http://localhost:8081 にアクセス
http://localhost:8080 にアクセス
$ http http://localhost:8080
HTTP/1.1 200 OK
Connection: keep-alive
Date: Fri, 23 May 2025 03:04:59 GMT
Keep-Alive: timeout=72
access-control-allow-origin: *
content-length: 135
content-type: application/json; charset=utf-8
{
"documentation": "https://github.com/supabase/postgres-meta",
"name": "@supabase/postgres-meta",
"status": 200,
"version": "0.0.0-automated"
}
バックグラウンドで起動
docker compose up -d
停止
docker compose down
$ docker compose down
[+] Running 6/6
✔ Container supabase-studio Removed 0.4s
✔ Container supabase-rest Removed 0.4s
✔ Container supabase-auth Removed 0.1s
✔ Container supabase-meta Removed 0.3s
✔ Container supabase-db Removed 0.3s
✔ Network ex01_default Removed