Production-ready PocketBase setup with Docker Compose and Nginx reverse proxy.
- Clone the repository:
git clone https://github.com/nazt/pocketbase-docker-nginx.git
cd pocketbase-docker-nginx- Copy the environment file:
cp .env.example .env- Start the services:
docker-compose up -d- Access PocketBase:
- Direct access: http://localhost:8092
- Via Nginx proxy: http://localhost
- Admin UI: http://localhost/_/
- Port: 8092 (direct access)
- Data:
./data/pb_data(local volume) - Version: 0.29.3 (configurable via build args)
- Port: 80 (HTTP)
- Proxy: Routes to PocketBase on port 8080
- Config:
./nginx/nginx.conf
[Client] → [Nginx:80] → [PocketBase:8090] → [Local Volume:./data/pb_data]
.
├── Dockerfile # PocketBase custom image
├── docker-compose.yml # Service orchestration
├── nginx/
│ └── nginx.conf # Nginx reverse proxy config
├── data/
│ └── pb_data/ # PocketBase data (gitignored)
├── .env.example # Environment template
└── README.md # This file
To upgrade PocketBase to a newer version:
# Upgrade to specific version
PB_VERSION=0.30.0 docker compose build pocketbase
docker compose up -d pocketbase
# Or edit docker-compose.yml and rebuild
docker compose build pocketbase
docker compose up -d pocketbaseFirst-time setup requires creating an admin account:
- Navigate to http://localhost/_/
- Create your admin account
- Configure PocketBase settings
docker-compose exec pocketbase /pb/pocketbase backupPlace backup in ./data/pb_data and restart:
docker-compose down
docker-compose up -ddocker-compose logs -f pocketbase
docker-compose logs -f nginxdocker-compose restartdocker-compose downdocker-compose down -v
rm -rf ./data/pb_data/*- PocketBase admin panel is at
/_/path - Configure "User IP proxy headers" in PocketBase settings (X-Real-IP, X-Forwarded-For)
- For production, use SSL/TLS certificates with Nginx
- Change default admin credentials immediately
MIT