Master the art of combining Supabase with Docker to simplify your dev process and deploy robust, scalable apps with ease. Discover how to make your development smoother and launch powerful solutions without a hitch.
Using Supabase with Docker lets developers create a local setup that matches production settings. This makes team collaboration and testing smoother by keeping things consistent. A basic grasp of Docker, PostgreSQL, and Supabase is handy before getting started. Docker simplifies kicking off and handling your Supabase instance, so you can allocate resources wisely and focus on building your app. The steps ahead will show you how to set up and run Supabase on Docker, making database and backend management straightforward.
First things first, you need Docker on your machine to get Supabase up and running. Head over to the official website to download and install Docker.
Next, let's create a Docker network so Supabase and its buddies can chat with each other:
docker network create supabase-network
Now, we need to set up some environment variables. Create a .env
file and pop in the following details:
POSTGRES_PASSWORD=your_postgres_password
POSTGRES_DB=your_database_name
ANON_KEY=your_anon_key
SERVICE_KEY=your_service_key
Make sure this file is in your project directory.
Time to create a docker-compose.yml
file in your project directory. Add this content:
version: '3.8'
services:
db:
image: postgres:13
container_name: supabase_db
restart: unless-stopped
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
networks:
- supabase-network
auth:
image: supabase/gotrue:latest
container_name: supabase_auth
restart: unless-stopped
environment:
GOTRUE_DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
GOTRUE_SITE_URL: http://localhost:8000
GOTRUE_API_URL: http://localhost:8000/auth/v1
GOTRUE_JWT_SECRET: ${SERVICE_KEY}
networks:
- supabase-network
depends_on:
- db
api:
image: supabase/postgrest:latest
container_name: supabase_api
restart: unless-stopped
environment:
PGRST_DB_URI: postgres://postgres:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
PGRST_DB_SCHEMA: public
PGRST_DB_ANON_ROLE: anon
PGRST_JWT_SECRET: ${ANON_KEY}
networks:
- supabase-network
depends_on:
- db
storage:
image: supabase/storage-api:latest
container_name: supabase_storage
restart: unless-stopped
environment:
POSTGREST_URL: http://localhost:3000
PGRST_JWT_SECRET: ${ANON_KEY}
DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
networks:
- supabase-network
depends_on:
- db
realtime:
image: supabase/realtime:latest
container_name: supabase_realtime
restart: unless-stopped
environment:
DB_HOST: db
DB_PORT: 5432
DB_NAME: ${POSTGRES_DB}
DB_USER: postgres
DB_PASSWORD: ${POSTGRES_PASSWORD}
REALTIME_PORT: 4000
networks:
- supabase-network
depends_on:
- db
networks:
supabase-network:
driver: bridge
This setup includes PostgreSQL, GoTrue, PostgREST, Storage API, and Realtime services for Supabase.
Navigate to your project directory and fire up all the services with Docker Compose:
docker-compose up -d
This command will build and start all the containers in detached mode. Easy peasy!
Let's make sure everything is running smoothly. Check the status of the containers:
docker-compose ps
You should see that all services are "Up". If not, well, time to do some troubleshooting!
Now, let's interact with Supabase:
psql
or a GUI like pgAdmin to access your PostgreSQL instance.http://localhost:8000/auth/v1
.http://localhost:4000
.Make sure you're hitting the right endpoints and managing your containers properly.
Explore our Supabase tutorials directory - an essential resource for learning how to create, deploy and manage robust server-side applications with ease and efficiency.
Nocode tools allow us to develop and deploy your new application 40-60% faster than regular app development methods.
Save time, money, and energy with an optimized hiring process. Access a pool of experts who are sourced, vetted, and matched to meet your precise requirements.
With the Bootstrapped platform, managing projects and developers has never been easier.
Bootstrapped offers a comprehensive suite of capabilities tailored for startups. Our expertise spans web and mobile app development, utilizing the latest technologies to ensure high performance and scalability. The team excels in creating intuitive user interfaces and seamless user experiences. We employ agile methodologies for flexible and efficient project management, ensuring timely delivery and adaptability to changing requirements. Additionally, Bootstrapped provides continuous support and maintenance, helping startups grow and evolve their digital products. Our services are designed to be affordable and high-quality, making them an ideal partner for new ventures.
Fast Development: Bootstrapped specializes in helping startup founders build web and mobile apps quickly, ensuring a fast go-to-market strategy.
Tailored Solutions: The company offers customized app development, adapting to specific business needs and goals, which ensures your app stands out in the competitive market.
Expert Team: With a team of experienced developers and designers, Bootstrapped ensures high-quality, reliable, and scalable app solutions.
Affordable Pricing: Ideal for startups, Bootstrapped offers cost-effective development services without compromising on quality.
Supportive Partnership: Beyond development, Bootstrapped provides ongoing support and consultation, fostering long-term success for your startup.
Agile Methodology: Utilizing agile development practices, Bootstrapped ensures flexibility, iterative progress, and swift adaptation to changes, enhancing project success.