π Deploy persistent docker-powered Frappe sites without building custom images
A simplified Docker setup for Frappe and ERPNext development that provides persistent storage and easy management through convenient scripts.
- No Custom Images Required: Uses official
frappe/bench:latestDocker image - Persistent Storage: Your bench and data persist across container restarts
- Easy Setup: Interactive setup script to configure your environment
- Development Ready: Includes file watching, debugging, and hot reload
- Full Stack: Includes MariaDB, Redis, web server, and all Frappe services
- Print Server: Optional CUPS integration for printing functionality
- CLI Tools: Convenient scripts to run bench commands
Before you begin, ensure you have the following installed:
- Docker (version 20.10 or later)
- Docker Compose (version 2.0 or later)
- Git
git clone https://github.com/Avunu/frappe-bench-docker.git
cd frappe-bench-dockerLinux/macOS:
./setup.shWindows (PowerShell):
.\setup.ps1The setup script will:
- Prompt you to configure environment variables (or use defaults)
- Create necessary configuration files
- Start all Docker services
- Initialize your Frappe bench
Once setup is complete, your Frappe site will be available at:
- URL: http://localhost:8080
- Username: Administrator
- Password: The password you set during setup (default:
admin)
The setup script creates a .env file with these configurable options:
| Variable | Default | Description |
|---|---|---|
FRAPPE_VERSION |
version-15 |
Frappe version to install |
FRAPPE_SITE_NAME_HEADER |
development.localhost |
Site name/domain |
SITE_PASSWORD |
admin |
Administrator password |
DB_ROOT_PASSWORD |
123 |
MariaDB root password |
CUPS_USER_ADMIN |
lpadmin |
CUPS admin username |
CUPS_USER_PASSWORD |
123 |
CUPS admin password |
If you prefer to configure manually:
-
Copy the example environment file:
cp .env.example .env
-
Edit
.envwith your preferred values -
Start the services:
docker compose up -d
Use the provided scripts to run bench commands:
Linux/macOS:
./bench.sh "list-apps"
./bench.sh "new-app myapp"
./bench.sh "install-app myapp"Windows (PowerShell):
.\bench.ps1 "list-apps"
.\bench.ps1 "new-app myapp"
.\bench.ps1 "install-app myapp"# List installed apps
./bench.sh "list-apps"
# Create a new app
./bench.sh "new-app myapp"
# Install an app to your site
./bench.sh "install-app myapp"
# Update bench
./bench.sh "update"
# Migrate your site
./bench.sh "migrate"
# Access bench console
./bench.sh "console"
# Clear cache
./bench.sh "clear-cache"# View running services
docker compose ps
# View logs
docker compose logs -f
# Stop all services
docker compose down
# Restart services
docker compose restart
# Rebuild and restart
docker compose up -d --buildThis setup includes the following services:
| Service | Purpose | Port |
|---|---|---|
configurator |
Initial setup and configuration | - |
backend |
Frappe web application | 8000 (internal) |
websocket |
Real-time communications | 9000 (internal) |
web |
Caddy reverse proxy | 8080 |
watch |
File watching for development | - |
schedule |
Scheduled job runner | - |
worker_* |
Background job workers | - |
mariadb |
Database server | 3306 (internal) |
redis-cache |
Cache server | 6379 (internal) |
redis-queue |
Queue server | 6379 (internal) |
cupsd |
Print server (optional) | 8631 |
- Frappe Bench:
./frappe-bench/(mounted as volume) - Database:
./mariadb-data/(mounted as volume) - Configuration:
./cupsd.conf,./printers.conf
The watch service automatically rebuilds assets when files change. This is enabled by default in development mode.
You can attach a debugger to the running backend service. The bench is available at /home/frappe/frappe-bench inside the containers.
To develop custom apps:
-
Create your app:
./bench.sh "new-app myapp" -
Your app will be created in
./frappe-bench/apps/myapp -
Install the app:
./bench.sh "install-app myapp" -
Edit files in
./frappe-bench/apps/myapp- changes will be reflected immediately
Services won't start:
- Ensure Docker is running
- Check if ports 8080 or 8631 are already in use
- Run
docker compose logsto see error messages
Site not accessible:
- Wait a few minutes for initial setup to complete
- Check that the
configuratorservice has finished running - Verify the
.configuredfile exists in./frappe-bench/
Permission errors:
- Ensure the
frappe-benchdirectory has correct permissions - The setup handles this automatically, but manual intervention may be needed
Database connection errors:
- Verify MariaDB service is running:
docker compose ps mariadb - Check database logs:
docker compose logs mariadb
To start fresh:
# Stop all services
docker compose down
# Remove all data (β οΈ This will delete your database and bench!)
sudo rm -rf frappe-bench mariadb-data .env cupsd.conf printers.conf
# Run setup again
./setup.sh- Check the official Frappe documentation
- Review frappe_docker documentation
- Open an issue in this repository for setup-specific problems
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork this repository
- Create a feature branch
- Make your changes
- Test the setup process
- Submit a pull request
- Frappe Framework for the excellent framework
- frappe_docker for the base Docker setup
- The Frappe community for continued support and development