Dokku with Docker: Heroku-Style Git Push Deploys on Your Own Server (Linux, Windows, Mac)
Before you start
- 16 min read
Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#
Dokku is a small, open-source platform-as-a-service that turns one Linux server into a Heroku-style home for your apps: you push with Git, Dokku builds a container, starts it, routes a domain to it, and can attach Postgres, persistent storage and HTTPS.
Logo: Dokku project (https://raw.githubusercontent.com/dokku/dokku/144f4cf681883b1ae151b268b7e912fb6df578fb/docs/assets/dokku-logo.svg), MIT.
The important split: Dokku runs on Linux; Windows and Mac are clients. The steps below show both sides.
Dokku suits a homelab or small team that wants git push deploys, a database and HTTPS without Kubernetes. It is not a desktop app or a managed platform: you own the server, updates and backups.
Want a web dashboard instead of a command line? Compare CapRover, Dokploy and Coolify. To host your app's code at home first, see Forgejo.
| What | Value (official sources, read 2 December 2026) |
|---|---|
| Current version | v0.38.34, released 30 October 2026 (commit fe93f24) |
| Install | wget -NP . https://dokku.com/install/v0.38.34/bootstrap.sh, then sudo DOKKU_TAG=v0.38.34 bash bootstrap.sh |
| Host OS | Ubuntu 22.04/24.04/26.04 or Debian 12/13; AMD64 or arm64 |
| Time needed | About 30-45 minutes (our estimate, not measured) |
| RAM | 1 GB minimum for the Docker scheduler (docs); 2 GB is comfortable (our estimate, not measured) |
| Ports | 22 for Git over SSH; 80 and 443 for web traffic |
| Default proxy | nginx; Traefik is an optional proxy plugin included in Dokku 0.28.0+ |
| Licence | MIT for the core; plugin repositories are separate |
| Official docs | dokku.com/docs and the source at v0.38.34 |
At a glance:
- What it is: a single-server PaaS on Docker, managed from the command line.
- Deploy and data:
git pushwith buildpacks or a Dockerfile; official database plugins such as Postgres; named persistent storage. - HTTPS: the letsencrypt plugin for nginx, or the optional Traefik plugin.
- Not included: no web control panel, no multi-node setup by default, no Windows server support. v0.38.34 is current; named storage entries are new in 0.38.0.
How it fits together#
A push goes over SSH to Dokku's Git receiver, which builds your app with buildpacks or your Dockerfile, starts the web container, connects the data services, and routes traffic through nginx or Traefik.
Drawn for this guide from the Dokku v0.38.34 docs and plugin source. The data services sit beside the app; they are not part of the build.
Three groups make the picture easier to read:
- App and builder: a named app gets one Git remote; buildpacks or a Dockerfile turn the push into an image.
- Proxy: nginx by default, or the Traefik plugin. Do not run both.
- Service and storage: a database plugin creates a service and sets
DATABASE_URL; a storage mount keeps files outside the container.
The order is push, build, release, run. Before each deploy Dokku removes dead containers and dangling images, but old image layers can still accumulate.
Before you start#
Note: every domain, password and key on this page is a dummy example (like
change-me). Replace it with your own and keep real secrets out of Git.
| System | What you need |
|---|---|
| Linux server | Ubuntu 22.04/24.04/26.04 or Debian 12/13, 1 GB RAM, root or sudo, a public or LAN IP, ports 22, 80 and 443 open |
| Windows client | Windows 10 or 11, PowerShell, Git for Windows 2.56.1.2 (includes OpenSSH), or the built-in OpenSSH client; you deploy to the Linux server |
| Mac client | macOS, Terminal, Git (xcode-select --install or brew install git); you deploy to the Linux server |
Check the client tools in PowerShell or Terminal:
ssh -V git --version
Both commands must print a version. If Git is missing on Windows, install it from gitforwindows.org; on a Mac, run xcode-select --install or brew install git.
Checklist:
- [ ] A Linux server with root or sudo and a reachable IP
- [ ] A domain you own, or a wildcard record such as
*.example.com; for HTTPS, each app needs a name that points at the server - [ ] Ports 22, 80 and 443 open in the firewall
- [ ] An SSH key on your computer, with the public key ready
Tested on 2026-12-02: Linux = not run, Windows = not run, Mac = not run. Every command comes from the official docs and source at v0.38.34, read 2 December 2026. The Windows and Mac client steps are adapted from those docs and were not run.
Tip: If your only computer runs Windows or Mac, use a small Linux VPS or VM. Dokku does not install on Windows or macOS.
Step 1: Install Dokku on the Linux server#
The bootstrap installs Docker and Dokku, creates the dokku user, and adds root's SSH keys. The docs say 5-10 minutes.
Linux#
ssh root@<server-ip> wget -NP . https://dokku.com/install/v0.38.34/bootstrap.sh sudo DOKKU_TAG=v0.38.34 bash bootstrap.sh dokku version
Windows (PowerShell)#
Connect to the Linux server from PowerShell, then run the same install commands there:
ssh root@<server-ip>
At the server prompt, run the three commands from the Linux section: wget, sudo DOKKU_TAG=v0.38.34 bash bootstrap.sh, and dokku version.
Mac (Terminal)#
Same as Windows: connect first, then run the Linux commands on the server.
ssh root@<server-ip>
Check it worked. dokku version prints the installed version; look for 0.38.34. We did not run it, so we show no invented output.
Tip: A non-root sudo account can run Dokku later; the bootstrap still needs root once.
Step 2: Add your SSH key and set the global domain#
Dokku's Git receiver checks its own key list, not root's authorized_keys. Confirm the key is in Dokku, then set the global domain.
Linux#
On the server:
cat ~/.ssh/authorized_keys | sudo dokku ssh-keys:add admin dokku ssh-keys:list dokku domains:set-global <your-domain>
dokku ssh-keys:list shows the keys Dokku will accept. If you do not have a domain yet, use a name such as <server-ip>.sslip.io; a real domain is better for HTTPS.
Windows (PowerShell)#
Create a key if you do not have one, then pipe the public key to the server:
ssh-keygen -t ed25519 -C "[email protected]" Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | ssh root@<server-ip> dokku ssh-keys:add <your-name>
The last line adapts the docs' public-key pipe to PowerShell. Then connect and set the domain:
ssh root@<server-ip> dokku ssh-keys:list dokku domains:set-global <your-domain>
Mac (Terminal)#
Create a key if you do not have one, then:
ssh-keygen -t ed25519 -C "[email protected]" cat ~/.ssh/id_ed25519.pub | ssh root@<server-ip> dokku ssh-keys:add <your-name> ssh root@<server-ip> dokku ssh-keys:list dokku domains:set-global <your-domain>
Check it worked. ssh-keys:list shows your key name, and the next deploy prints the app URL under the global domain you set.
Tip: The Git user is always
dokku, not root.git push root@...fails even when root's SSH key works.
Step 3: Create and deploy your first app#
This is the full first deploy, using the official Heroku Ruby sample from the Dokku docs; your own repo uses the same mechanics.
Linux#
On the server, create the app:
dokku apps:create ruby-getting-started
On your computer, clone the sample and push:
git clone https://github.com/heroku/ruby-getting-started cd ruby-getting-started git remote add dokku dokku@<server-ip>:ruby-getting-started git push dokku main
The docs example ends with:
=====> Application deployed:
http://ruby-getting-started.dokku.me
Your URL uses your global domain instead of dokku.me.
Windows (PowerShell)#
git clone https://github.com/heroku/ruby-getting-started Set-Location ruby-getting-started git remote add dokku dokku@<server-ip>:ruby-getting-started git push dokku main
Mac (Terminal)#
Same commands as Linux:
git clone https://github.com/heroku/ruby-getting-started cd ruby-getting-started git remote add dokku dokku@<server-ip>:ruby-getting-started git push dokku main
Check it worked. Open the URL; a Ruby build can take a few minutes. The final Application deployed: line is the success signal.
Tip: Your app must listen on
PORT; an app that ignores it gives a 502.
Tip: The remote user must be
dokku. If the old Ruby sample fails to build, use your own app or a Dockerfile; the push and routing steps do not change.
If you change code, commit it and push again. To rebuild the same commit without a new push, run dokku ps:rebuild ruby-getting-started on the server.
Step 4: Add Postgres and link it#
Dokku does not bundle a database. The official Postgres plugin adds one as a service; linking it sets DATABASE_URL.
Linux#
On the server:
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git --name postgres dokku postgres:create railsdatabase dokku postgres:link railsdatabase ruby-getting-started
The plugin README lists Dokku 0.35.x+ and Docker 1.8.x, and defaults to Postgres 19.0 at the time of writing. Creating a service can take a few moments.
Windows (PowerShell)#
Connect first, then run the same three commands on the server:
ssh root@<server-ip>
Mac (Terminal)#
Same as Windows: ssh root@<server-ip>, then the three commands.
Check it worked. The link sets DATABASE_URL. If the app was already running, rebuild it with dokku ps:rebuild ruby-getting-started.
Tip: A linked database is not a backup. The Updates section shows export and S3 backup commands; test a restore on a scratch service.
Step 5: Add persistent storage#
Containers are disposable: files outside a mounted path disappear on the next deploy. Named storage entries are new in 0.38.0.
Linux#
On the server:
dokku storage:create ruby-getting-started-data dokku storage:mount ruby-getting-started ruby-getting-started-data --container-dir /app/storage dokku ps:restart ruby-getting-started
The container path is absolute. If it already has content, the mount overwrites it; files are not merged.
Windows (PowerShell)#
Connect first, then run the same three storage commands on the server:
ssh root@<server-ip>
Mac (Terminal)#
Same as Windows: ssh root@<server-ip>, then the three storage commands.
Check it worked. dokku storage:list ruby-getting-started lists the mount. The docs example for another app looks like this:
-----> node-js-app volume bind-mounts:
/var/lib/dokku/data/storage/node-js-app:/app/storage
Your entry name and app name will differ.
Tip: Buildpack apps run as
herokuishuserand Dokku sets the owner. A root Dockerfile app usually needs--chown root; a custom UID needs--chown falseand a manualchown. Wrong ownership is a common reason files do not persist.
Put it behind HTTPS with Traefik#
Dokku's default proxy is nginx. There are two supported ways to get HTTPS; pick one, not both. Dokku's proxy plugins are nginx and Traefik; this guide does not put Caddy in front.
Without Traefik: nginx and Let's Encrypt#
This is the normal Dokku path. The app must already be deployed and reachable over HTTP on port 80 before you enable the certificate.
On the server:
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git dokku letsencrypt:set --global email <your-email> dokku domains:set ruby-getting-started ruby-getting-started.<your-domain> dokku letsencrypt:enable ruby-getting-started dokku letsencrypt:cron-job --add
Check it worked. dokku letsencrypt:active ruby-getting-started prints true; dokku letsencrypt:list shows the expiry. Open the HTTPS URL or run curl -I and look for a 200 or 301.
Tip: Confirm
http://...loads beforeletsencrypt:enable; the HTTP-01 challenge needs a live response.
Tip: With Cloudflare, use proxied mode and SSL/TLS Full. Flexible breaks renewals.
With Traefik#
Dokku includes the Traefik proxy integration as of 0.28.0. It needs Docker's docker-compose-plugin. Switch one app at a time, rebuild, then enable Let's Encrypt:
dokku proxy:set ruby-getting-started type traefik dokku ps:rebuild ruby-getting-started dokku traefik:set --global letsencrypt-email <your-email> dokku ps:rebuild ruby-getting-started dokku traefik:stop dokku traefik:start dokku traefik:report
The plugin only uses its own Let's Encrypt integration; certs plugin certificates are ignored. Only web containers get labels, only http:80 and https:443 are supported, and label changes need a rebuild. Do not run both proxies.
The docs report example shows traefik:v2.8, but the v0.38.34 Dockerfile is FROM traefik:v3.7.16; the running container uses the Dockerfile image.
The labels, line by line#
Dokku's plugin injects the router and TLS labels for you. These are the standard labels for a Traefik you manage yourself:
traefik.enable=true traefik.http.routers.dokku-app.rule=Host(`app.example.com`) traefik.http.routers.dokku-app.entrypoints=https traefik.http.routers.dokku-app.tls=true traefik.http.routers.dokku-app.tls.certresolver=le traefik.http.services.dokku-app.loadbalancer.server.port=3000
| Line | What it does |
|---|---|
traefik.enable=true | Tells Traefik to route this container. |
traefik.http.routers.dokku-app.rule=Host(...) | Matches the hostname; replace dokku-app with a unique router name. |
traefik.http.routers.dokku-app.entrypoints=https | Listens on the HTTPS entry point. |
traefik.http.routers.dokku-app.tls=true | Turns on TLS for this router. |
traefik.http.routers.dokku-app.tls.certresolver=le | Uses the certificate resolver named le. |
traefik.http.services.dokku-app.loadbalancer.server.port=3000 | Sends traffic to the container port. |
Important: le belongs to a Traefik you manage yourself. Dokku's plugin names its resolver leresolver; a le router in Dokku has no matching resolver, so that router gets no certificate. Most readers should add no labels: the plugin already did it.
Tip: After changing a domain, port mapping or proxy type, run
dokku ps:rebuild <app>; Traefik reads labels at container start.
Security and testing#
| Control | How |
|---|---|
| SSH access | Dokku users are managed with ssh-keys. A key named admin can add more keys remotely; use separate admin and deploy keys. |
| Firewall | Expose 22, 80 and 443 only. Do not publish the Postgres port; the app reaches the service over Docker's network. |
| Secrets | Keep database passwords and API keys in environment variables, not in Git. Do not paste dokku output that contains secrets. |
| HTTPS and status | Run curl -I https://<app>.<your-domain>/; dokku letsencrypt:active <app>, dokku storage:list <app> and dokku traefik:report show the important state. |
The server is the boundary: anyone who can push can run code in that app's container and read its config, and root on the host controls everything.
Common mistakes#
| Mistake | Why it happens | Do this instead |
|---|---|---|
Adding your key only to root's authorized_keys | Root can log in, but Dokku's Git receiver checks its own key list | sudo dokku ssh-keys:add <name> <key-file> on the server, then dokku ssh-keys:list |
Using old commands from tutorials or AI answers: dokku tags:deploy | The tags plugin was deprecated in 0.24.0; old posts and AI answers repeat it | Check the command in the docs for your version; use dokku ports:set for port mappings |
Expecting EXPOSE in the Dockerfile to publish the port | Dokku maps ports through its proxy config, not Docker's EXPOSE alone | dokku ports:set <app> http:80:<container-port> |
| Letting the disk fill with old images | Old image layers and build cache accumulate; a full disk can make an app look undeployed | Watch df -h, keep free space, and remove unused images and build cache during maintenance |
| Enabling Let's Encrypt before DNS and HTTP work | The HTTP-01 challenge needs the name to resolve and the app to answer on port 80 | Point DNS first, check http://<app>.<your-domain>/, then enable the certificate |
| Upgrading without reading the migration guide | Proxy and config behaviour changes between releases | Read the upgrade guide for the target version, then dokku ps:rebuild --all |
AI assistants: copying tls.certresolver=le into Dokku's Traefik labels | le is a common name in self-managed Traefik tutorials; Dokku's plugin names its resolver leresolver | Use the plugin's automatic labels, or change the resolver name to leresolver |
Tip: Run one manual deployment and read it; test a Postgres restore on a scratch service before you need it.
Troubleshooting#
| Problem | Solution |
|---|---|
Permission denied (publickey) when pushing | The key is not in Dokku. Run dokku ssh-keys:list, add it with ssh-keys:add, and make sure your private key is loaded in ssh-agent. |
| A command says it is not a Dokku command | It may be from an old release or a removed plugin. Check the docs for your version; for ports, use dokku ports:set. |
| The app returns 502 after deploy | The container is not answering on the port Dokku expects. Check that the app listens on PORT; if needed, run dokku ports:set <app> http:80:<container-port>. |
| The disk is full and an app looks undeployed | Free space, then retry. Check df -h; old images and build cache are common causes. |
| Let's Encrypt fails | Confirm DNS points at the server, http://... answers, and ports 80/443 are open. dokku letsencrypt:active <app> shows the current state. |
| Apps lose their nginx upstream after an upgrade | Follow the migration guide and run dokku ps:rebuild --all. |
Exact error texts#
Permission denied (publickey). fatal: Could not read from remote repository.#
This is the Git push failing at SSH authentication, not a Dokku build error. Add the key to Dokku and load the private key into your agent. Issue #5011 is an example; the thread fixed it by regenerating keys and adding them to the agent.
! tags:deploy hasura is not a dokku command.#
The tags plugin was deprecated in 0.24.0. The reporter was on 0.26.6 and followed an old guide. Use the current docs for your version; do not copy commands from old tutorials or AI answers.
connect() failed (111: Connection refused) while connecting to upstream#
nginx reached the app container but nothing was listening on the expected port. Check the app's PORT, then correct the mapping with dokku ports:set <app> http:80:<container-port> and rebuild.
Known bugs and open reports#
- Image cache not cleaned automatically. Issue #7604 is open: old images can fill the disk. Watch free space and clean unused images during maintenance.
- A full disk can make an app look undeployed. Issue #2577 reports this; free space before retrying a deploy. The issue body was truncated when we read it.
- Upgrade can leave apps without an nginx upstream. Issue #7253 reports it after an upgrade. Follow the migration guide and rebuild all apps. The issue body was truncated when we read it.
This is a small sample of reports, not a failure rate. GitHub's API returned 403 during research, so we could not search every issue.
Updates, backups and safe upgrades#
Dokku is a server package, not a container you pull. Read the migration guide for every version between your current release and the target.
sudo apt-get update sudo apt-get --no-install-recommends install dokku herokuish sshcommand plugn gliderlabs-sigil dokku-update dokku-event-listener dokku ps:rebuild --all
If you also upgrade Docker or herokuish, stop all apps first with dokku ps:stop --all, then upgrade and rebuild. The dokku-update package is the recommended helper; use its own docs for the command.
The guide's specific-version line sudo apt-get dokku=$VERSION lacks install; do not copy it.
Back up on two layers:
dokku postgres:export railsdatabase -f <path-on-server>
dokku postgres:backup-auth railsdatabase <aws-access-key-id> <aws-secret-access-key> <aws-default-region> <aws-signature-version> <endpoint-url> dokku postgres:backup railsdatabase <bucket-name> dokku postgres:backup-schedule railsdatabase "<schedule>" <bucket-name>
Keep the repo, environment variables and export; test a restore on a scratch service.
For S3 storage you run yourself, see Garage. For the volumes of other Docker apps on the same server, see docker-volume-backup.
Tip: The 0.38 guide matters for storage: named entries are new, and old colon-form mounts migrate automatically.
Performance and resources#
The docs give a 1 GB minimum for the Docker scheduler; 2 GB is a sensible starting point if Postgres and a build share the machine. We measured nothing.
Builds are the heavy part; runtime memory depends on your app and database. Use docker stats for real numbers. Disk is the limit to watch: Dokku cleans dead containers and dangling images, but old layers and build cache still accumulate (issue #7604). Keep free space and prune unused images. Dokku also has a K3s scheduler, but this guide covers the default single-server Docker setup.
FAQ#
Do I install Dokku on Windows or Mac? No. Dokku runs on Linux. Windows and Mac are clients: you use Git and SSH there to push to a Linux server.
Can I use Dokku without a domain? Yes, for a LAN test. Use a name such as <server-ip>.sslip.io as the global domain. For a public HTTPS certificate, use a domain that points at the server.
Should I use nginx or Traefik? Use nginx unless you already know Traefik or need its features. nginx is the default and works with the letsencrypt plugin. Do not run both proxies on one installation.
How do I add a database? Install the official Postgres plugin, create a service, and link it to the app. Linking sets DATABASE_URL. The service has its own data volume, so back it up separately from the app.
How do I update Dokku? Read the migration guide, upgrade with apt or dokku-update, then dokku ps:rebuild --all. If you also upgrade Docker or herokuish, stop all apps first.
Sources#
- Dokku release v0.38.34, LICENSE, installation docs, application deployment, user management, persistent storage, upgrading
- Traefik proxy docs, Traefik Dockerfile, compose template, deploy labels script
- dokku-letsencrypt README and dokku-postgres README, read 2 December 2026
- GitHub issues #5011, #7604, #3514, #1427, #4940, #6655, #4067, #2577 and #7253
- Git for Windows, Git for Windows install page, Git for Mac install page, GitHub SSH key guide, Microsoft OpenSSH key management
We did not run Dokku on a real machine in this job. Every command is copied from the sources above; the Windows and Mac client steps are adapted and were not run.
Checked against the official docs on 2026-12-02.