Overview
This guide shows how to:- Add Basecut CLI to your Docker Compose setup
- Restore snapshots as part of
docker compose up - Use
BASECUT_DATABASE_URLwith Docker networks - Share snapshots across your team
This guide focuses on local execution - Basecut CLI runs in a container and connects to your database container. For production workloads, see Agent Deployment.
Basic Setup
1. Add Basecut Service to docker-compose.yml
Add a Basecut service that runs after your database is ready:2. Restore Snapshot on Startup
Run Basecut restore as part of your startup:Using Docker Networks
When your database is in a Docker network, use the service name as the hostname:Custom Basecut Image
Create a custom Docker image with Basecut pre-installed for faster startup:Environment Variables
Store Basecut credentials securely:Option 1: .env File (Local Development)
.env:
Option 2: Docker Secrets (Production)
For production, use Docker secrets and export the value before running Basecut:Complete Example
Full docker-compose.yml with app, database, and Basecut:Tips
- Use profiles: The
profilesdirective lets you run Basecut restore only when needed, not on everydocker compose up - Health checks: Ensure your database is healthy before restoring (prevents connection errors)
- Volume mounts: Mount
basecut.ymland snapshot directories if using local storage - Idempotency: Use
--yesflag to skip confirmation prompts in CI/automated environments
Next Steps
- Learn about execution modes (local vs agent)
- Set up CI/CD integration for automated snapshots
- Explore common workflows for different use cases