# Dokku — The Smallest PaaS Implementation You've Ever Seen > Dokku is a Docker-powered PaaS that helps you build and manage app lifecycles. git push to deploy, automatic SSL, plugin ecosystem — your own Heroku on a single server. ## Install Save as a script file and run: ## Quick Use ```bash # Install on Ubuntu 22.04+ wget -NP . https://dokku.com/install/v0.34.8/bootstrap.sh sudo DOKKU_TAG=v0.34.8 bash bootstrap.sh # Create app dokku apps:create my-app # Deploy with git push git remote add dokku dokku@your-server:my-app git push dokku main ``` Your app is live at `http://my-app.your-server.com` with automatic SSL. ## Intro **Dokku** is the smallest PaaS implementation you've ever seen. Powered by Docker, it provides a Heroku-like experience on your own server — git push deployment, automatic HTTPS via Let's Encrypt, buildpack and Dockerfile support, and a rich plugin ecosystem for databases, caching, and more. With 31.9K+ GitHub stars and MIT license, Dokku is the most popular self-hosted PaaS, perfect for indie developers, small teams, and anyone who wants Heroku simplicity without Heroku pricing. ## What Dokku Does - **Git Push Deploy**: Push code, Dokku builds and deploys automatically - **Buildpacks**: Auto-detect language and build (Node.js, Python, Ruby, Go, PHP, Java, etc.) - **Dockerfile**: Deploy any Dockerfile-based application - **Docker Image**: Deploy pre-built Docker images directly - **Automatic HTTPS**: Let's Encrypt certificates provisioned and renewed automatically - **Zero Downtime**: Zero-downtime deploys with health checks - **Scaling**: Scale app processes horizontally - **Plugins**: PostgreSQL, MySQL, Redis, MongoDB, RabbitMQ, and 100+ community plugins - **Domains**: Custom domain management with automatic routing - **Environment Variables**: Secure config management ## Architecture ``` Developer │ │ git push dokku main │ ┌───┴───────────────────────────────────┐ │ Dokku Server │ │ ┌─────────┐ ┌────────────────────┐ │ │ │ Git │──│ Builder │ │ │ │ Receive │ │ (Buildpack/Docker) │ │ │ └─────────┘ └────────┬───────────┘ │ │ │ │ │ ┌──────────────────────┴───────────┐ │ │ │ Docker Container (your app) │ │ │ └──────────────────────────────────┘ │ │ ┌──────────────────────────────────┐ │ │ │ Nginx (reverse proxy + SSL) │ │ │ └──────────────────────────────────┘ │ └───────────────────────────────────────┘ ``` ## Getting Started ### 1. Install Dokku ```bash # On a fresh Ubuntu 22.04+ server wget -NP . https://dokku.com/install/v0.34.8/bootstrap.sh sudo DOKKU_TAG=v0.34.8 bash bootstrap.sh # Set domain dokku domains:set-global your-server.com # Add your SSH key echo "your-public-key" | dokku ssh-keys:add admin ``` ### 2. Create App ```bash dokku apps:create my-node-app ``` ### 3. Add Database ```bash # Install PostgreSQL plugin dokku plugin:install https://github.com/dokku/dokku-postgres.git # Create database and link to app dokku postgres:create my-db dokku postgres:link my-db my-node-app # DATABASE_URL is automatically set in app environment ``` ### 4. Deploy ```bash # On your local machine git remote add dokku dokku@your-server.com:my-node-app git push dokku main ``` ### 5. Enable HTTPS ```bash dokku letsencrypt:enable my-node-app # Auto-renews via cron ``` ## Common Commands ```bash # App management dokku apps:list # List all apps dokku apps:create my-app # Create app dokku apps:destroy my-app # Delete app # Configuration dokku config:set my-app KEY=value # Set env var dokku config:show my-app # Show all env vars # Domains & SSL dokku domains:add my-app example.com # Add custom domain dokku letsencrypt:enable my-app # Enable HTTPS # Scaling dokku ps:scale my-app web=3 worker=2 # Scale processes # Databases (plugins) dokku postgres:create db1 # Create PostgreSQL dokku redis:create cache1 # Create Redis dokku postgres:link db1 my-app # Link to app # Logs & debugging dokku logs my-app -t # Tail logs dokku enter my-app web # Shell into container dokku run my-app npm run migrate # Run one-off command ``` ## Supported Languages | Language | Detection | Build Method | |----------|-----------|-------------| | Node.js | package.json | Buildpack | | Python | requirements.txt / Pipfile | Buildpack | | Ruby | Gemfile | Buildpack | | Go | go.mod | Buildpack | | PHP | composer.json | Buildpack | | Java | pom.xml / build.gradle | Buildpack | | Static | index.html | Buildpack (nginx) | | Any | Dockerfile | Docker build | ## Dokku vs Alternatives | Feature | Dokku | Heroku | CapRover | Coolify | |---------|-------|--------|----------|---------| | Open Source | Yes (MIT) | No | Yes | Yes | | Git push deploy | Yes | Yes | Yes | Yes | | Auto HTTPS | Let's Encrypt | Built-in | Let's Encrypt | Let's Encrypt | | Buildpacks | Heroku compatible | Native | Dockerfile | Nixpacks | | Database plugins | Official | Add-ons | One-click apps | One-click | | Multi-server | Via plugins | Built-in | Docker Swarm | Yes | | Pricing | Free (VPS cost) | $5+/dyno/mo | Free (VPS cost) | Free (VPS cost) | | Best for | Single server | SaaS | Web UI fans | Modern UI fans | ## 常见问题 **Q: Dokku 和 CapRover 怎么选?** A: Dokku 更贴近 Heroku 体验,命令行操作为主,buildpack 生态成熟。CapRover 有漂亮的 Web UI,更适合不习惯命令行的用户。功能上两者相当,个人偏好决定。 **Q: 一台服务器能跑多少个应用?** A: 取决于应用资源消耗。一台 4GB RAM 的 VPS 通常可以跑 5-10 个小型 Web 应用(Node.js/Python)+ 对应数据库。建议每个应用设置内存限制。 **Q: 支持多服务器集群吗?** A: Dokku 默认是单服务器架构。通过 dokku-scheduler-k3s 插件可以扩展到 K3s 集群。对于多服务器需求,也可以考虑 Coolify 或 CapRover。 ## 来源与致谢 - GitHub: [dokku/dokku](https://github.com/dokku/dokku) — 31.9K+ ⭐ | MIT - 官网: [dokku.com](https://dokku.com) --- Source: https://tokrepo.com/en/workflows/ed054bbe-34d8-11f1-9bc6-00163e2b0d79 Author: Script Depot