Docker Environment Management
Start and manage the application in Docker with SQLite database.
Quick Start
Start in foreground (with logs)
bash
make docker-up
Start in background (detached)
bash
make docker-up-d
View logs
bash
make docker-logs
Stop containers
bash
make docker-down
What Gets Started
- •Application: Go web service on configured port (default: 8080)
- •Database: SQLite at
./data/budget.db(persisted in Docker volume) - •Health check: Automatic container health monitoring via
/healthendpoint - •Auto-migrations: Database schema applied on startup
Docker Image Details
- •Base: Alpine Linux (~50MB total size)
- •Platform: Multi-arch (linux/amd64, linux/arm64)
- •Registry: GitHub Container Registry
- •Security: Trivy vulnerability scanning enabled
Environment Configuration
Create .env file in project root to override defaults:
bash
SERVER_PORT=8080 SERVER_HOST=0.0.0.0 DATABASE_PATH=/data/budget.db SESSION_SECRET=your-secret-key-here LOG_LEVEL=info ENVIRONMENT=production
Data Persistence
Database is persisted in Docker volume at ./data/:
- •Development:
./data/budget.db - •Backups:
./backups/directory
Data survives container restarts and rebuilds.
Common Tasks
Rebuild after code changes
bash
make docker-build make docker-up
Check container status
bash
docker ps
Execute command in container
bash
docker exec -it family-budget-service sh
View container logs (live)
bash
make docker-logs -f
Health Checks
The container includes automatic health monitoring:
- •Endpoint:
/health - •Interval: 30 seconds
- •Timeout: 10 seconds
- •Retries: 3
Check health status:
bash
curl http://localhost:8080/health
Expected response:
json
{"status":"healthy","timestamp":"2026-01-30T10:45:00Z"}
Troubleshooting
Container won't start
- •Check logs:
make docker-logs - •Verify port not in use:
lsof -i :8080 - •Check Docker daemon:
docker info
Database issues
- •Verify volume exists:
docker volume ls - •Check permissions:
ls -la ./data/ - •Restore from backup:
/db-backup
Build failures
- •Clean old images:
docker system prune - •Rebuild:
make docker-build - •Check disk space:
df -h
See Also
- •
make run-local- Run without Docker for development - •
make docker-build- Build Docker image only - •
/db-backup- Backup database before Docker operations