How to Run Databases Locally Without Docker
You open a new project. You need PostgreSQL. Maybe Redis too, for caching. And a vector database because the feature spec mentions semantic search. So you write a docker-compose.yml, pull three images, wait for them to download, configure ports and volumes, troubleshoot a permissions issue on the mounted data directory, and eventually get everything running. Docker Desktop is using 4 GB of RAM in the background. Your laptop fan starts spinning. You haven't written a single line of application code yet.
I've done this hundreds of times. Docker is great for production, for CI, for shipping containers to a cluster. But for local development, it's a heavyweight solution to a lightweight problem. You don't need a Linux VM to run PostgreSQL on your Mac. You just need the binary.
There's a simpler way.
Contents
- What Is the Layerbase CLI?
- Install and Create Your First Database
- Docker Compose vs Layerbase CLI: Side by Side
- Managing Your Instances
- When Docker Still Makes Sense
- Layerbase Cloud: Skip the Local Setup Entirely
- Layerbase Desktop: A GUI Alternative
What Is the Layerbase CLI?
The Layerbase CLI (formerly SpinDB) is a command-line tool that downloads and runs database engines as native binaries. No containers, no VMs, no Docker daemon. You install it with npm, create a named instance, and the database is running. It handles port assignment, data directories, and lifecycle management for 20+ engines. (What is the Layerbase CLI?)
The key difference from Docker: the Layerbase CLI runs the actual database binary directly on your machine. PostgreSQL runs as a native process, not inside a Linux container running inside a hypervisor. Redis runs as Redis. The overhead is the overhead of the database itself, nothing more.
Install and Create Your First Database
Install the Layerbase CLI globally:
npm i -g layerbase # npm
pnpm add -g layerbase # pnpmNow create a PostgreSQL instance:
lbase create mypostgres -e postgresql --startThat's it. The Layerbase CLI downloads the PostgreSQL binary for your platform (if it hasn't already), creates a data directory, initializes the cluster, and starts the server. The whole process takes a few seconds on the first run, and is nearly instant after that because the binary is cached.
Check the connection URL:
lbase url mypostgrespostgresql://127.0.0.1:5432/mypostgresLet's keep going. Create a Redis instance and a Qdrant instance:
lbase create myredis -e redis --start
lbase create myqdrant -e qdrant --startThree databases, three commands, running in seconds. No YAML files. No image pulls. No waiting.
lbase listmypostgres postgresql running postgresql://127.0.0.1:5432/mypostgres
myredis redis running redis://127.0.0.1:6379
myqdrant qdrant running http://127.0.0.1:6333Each engine gets its own default port. The CLI handles port conflicts automatically if you create multiple instances of the same engine.
Docker Compose vs Layerbase CLI: Side by Side
Let's say your project needs PostgreSQL for data, Redis for caching, and Qdrant for vector search. Here's what setup looks like with each approach.
The Docker Compose Approach
Create a docker-compose.yml:
version: '3.8'
services:
postgres:
image: postgres:16
ports:
- '5432:5432'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: myapp
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:7
ports:
- '6379:6379'
volumes:
- redisdata:/data
qdrant:
image: qdrant/qdrant:latest
ports:
- '6333:6333'
- '6334:6334'
volumes:
- qdrantdata:/qdrant/storage
volumes:
pgdata:
redisdata:
qdrantdata:Then run it:
docker compose up -dThe first time, Docker pulls all three images. That's potentially a few gigabytes of downloads depending on what's already cached. The PostgreSQL image alone is 400+ MB. Once running, Docker Desktop sits in the background consuming RAM for the VM that hosts the containers. On macOS, file system performance through the VM's volume mounts is noticeably slower than native disk access.
This works. Millions of developers use this setup every day. But it's a lot of ceremony for "I want PostgreSQL running on localhost."
The Layerbase CLI Approach
lbase create mypostgres -e postgresql --start
lbase create myredis -e redis --start
lbase create myqdrant -e qdrant --startThree commands. No configuration file. No image downloads (the Layerbase CLI's binaries are much smaller than Docker images because they're just the database, not an entire Linux userland). No background VM. The databases run as native processes, so disk I/O is native speed and memory usage is only what each database actually needs.
Your connection URLs work the same way:
lbase url mypostgres # postgresql://127.0.0.1:5432/mypostgres
lbase url myredis # redis://127.0.0.1:6379
lbase url myqdrant # http://127.0.0.1:6333Same ports, same protocols, same connection strings you'd use with Docker. Your application code doesn't change at all.
Managing Your Instances
The Layerbase CLI gives you a small set of commands that cover the full lifecycle.
Stop and Start
lbase stop mypostgres # Stop PostgreSQL
lbase start mypostgres # Start it againData persists between stops and starts. The CLI manages the data directory for each instance.
Get Connection Details
lbase url mypostgrespostgresql://127.0.0.1:5432/mypostgresPipe this into your .env file or pass it directly to your app. The URL format matches what every driver and ORM expects.
Connect Directly
lbase connect mypostgresThis drops you into the database's native CLI. For PostgreSQL, that's psql. For Redis, redis-cli. No need to install the CLI tools separately.
List All Instances
lbase listSee every instance you've created, its engine, its status (running or stopped), and its connection URL. One view of everything.
The Full Workflow
Here's what a typical day looks like. You start your project's databases in the morning:
lbase start mypostgres
lbase start myredisYou work all day. Your app connects to localhost:5432 and localhost:6379 like it always has. At the end of the day:
lbase stop mypostgres
lbase stop myredisNo Docker Desktop running in the background overnight. No VM using memory while you sleep. Start the databases when you need them, stop them when you don't.
When Docker Still Makes Sense
I want to be fair here. The Layerbase CLI is a local development tool. Docker does things the Layerbase CLI doesn't try to do, and there are real scenarios where Docker is the right choice.
Production parity. If your production environment runs containers on Kubernetes or ECS, running the same containers locally ensures your development environment matches. Configuration, init scripts, and runtime behavior are identical. The Layerbase CLI gets you a running database quickly, but it's not replicating your exact production setup.
CI/CD pipelines. GitHub Actions, GitLab CI, and most CI systems have first-class Docker support. Spinning up a PostgreSQL container in a CI pipeline is well-documented and reliable. The Layerbase CLI is focused on your local machine.
Complex networking. If your development setup involves multiple services talking to each other through Docker's internal networking (service discovery by container name, custom networks, network policies), Docker Compose handles that natively. The Layerbase CLI runs databases on localhost.
Custom images. If you need a PostgreSQL instance with specific extensions pre-installed, custom postgresql.conf settings, or init scripts that seed data on first boot, a Dockerfile gives you that reproducibility.
Team standardization. A docker-compose.yml committed to the repo means every developer gets the exact same setup. The CLI's instances are local to each machine. Both approaches work for teams, but Docker has a longer track record here.
The short version: use Docker when you need containerization. Use the Layerbase CLI when you just need a database running.
Layerbase Cloud: Skip the Local Setup Entirely
Sometimes you don't want to run anything locally at all. Maybe you're on a low-powered machine, or you're collaborating with someone who needs access to the same database, or you just want a connection URL without managing any infrastructure.
Layerbase Cloud gives you managed database instances for PostgreSQL, Valkey, Qdrant, and many other engines. Create an instance, grab the connection URL from the Quick Connect panel, and point your app at it. TLS is included, backups are handled, and the database runs on dedicated infrastructure instead of your laptop.
Your application code stays the same. Just swap the localhost URL for the cloud URL.
Layerbase Desktop: A GUI Alternative
If you prefer clicking over typing, Layerbase Desktop wraps SpinDB in a desktop GUI. Create instances, start and stop them, view connection details, and manage everything visually. Same engines, same native binaries under the hood, just with a graphical interface instead of a terminal.
Wrapping Up
Docker is a powerful tool that solves real problems. But for local database development, it solves them with more overhead than most projects need. The Layerbase CLI gives you the same databases, running natively, with less setup and less resource usage.
Install the Layerbase CLI and try it:
npm i -g layerbase
lbase create mydb -e postgresql --start
lbase url mydbThe Layerbase CLI supports 20+ database engines, from PostgreSQL and MySQL to MongoDB, ClickHouse, Qdrant, and SurrealDB. One CLI for all of them.
To manage your instances:
lbase stop mypostgres # Stop PostgreSQL
lbase stop myredis # Stop Redis
lbase stop myqdrant # Stop Qdrant
lbase start mypostgres # Start PostgreSQL again
lbase list # See all instancesKeep reading
- Local development for Lovable apps without DockerLovable runs in the cloud, but you still want a local copy of the app pointing at a local database for testing. Here is how to do that without Docker, in under a minute.
- A database setup for software development agenciesIf you build software for clients, you do not have a stack. You have everyone else's. Here is how to run all of those databases, local and hosted, from one place.
- Docker Compose vs SpinDB for Local DBsA practical comparison of Docker Compose and SpinDB for running local development databases, covering setup, resource usage, and when each approach makes sense.
- How to Manage Multiple Databases LocallyA practical guide to running PostgreSQL, Redis, Qdrant, ClickHouse, and other databases side by side on your local machine without the configuration headaches.