Create and remove Dokku apps
A full step-by-step checklist for creating a Dokku app, assigning a subdomain, adding HTTPS, pushing code, setting environment variables, and safely removing an app.
Create app
Create Dokku app
Create the Dokku app first, then assign a subdomain to it.
dokku apps:create <app_name>
dokku domains:set <app_name> <subdomain>.fastfastapps.com
Configure ports
Map the public-facing HTTP/HTTPS ports to the port your app's process listens on internally, so Dokku's nginx proxy knows where to send traffic.
dokku ports:set <app_name> http:80:3000 https:443:3000
80 (HTTP) and 443
(HTTPS) to internal container port 3000. Replace
3000 with whatever port your app actually binds to.
Add HTTPS
Enable Let's Encrypt HTTPS for Dokku apps, add the renewal cron job, and clean unused resources.
EMAIL=<email_address>
for app in $(dokku apps:list); do
dokku letsencrypt:set $app email ${EMAIL}
dokku letsencrypt:enable $app
done
dokku letsencrypt:cron-job --add
dokku cleanup
docker system prune -af
Add Dokku remote to Git repository
Add the Dokku server as a Git remote for your local Git repository.
git remote add dokku dokku@fastfastapps.com:<app_name>
git push dokku <branch_name>
git remote remove dokku
Push code
Push your branch to Dokku. Dokku will build the app and deploy it to the VPS.
git push dokku <branch_name>
Add environment variables
Set environment variables for your Dokku app.
dokku config:set <app_name> KEY=VALUE
To see all currently set env vars for an app:
dokku config:show <app_name>
To clean all config and trigger a rebuild, clear the app config.
dokku config:clear <app_name>
Operations
View logs
Stream or tail the logs for a running Dokku app.
dokku logs <app_name>
dokku logs <app_name> -t
dokku logs <app_name> -n 100
Run command on a container
Execute a one-off command inside an app container — useful for migrations, console access, or debugging.
dokku run <app_name> <command>
dokku run <app_name> bash
dokku run spawns a temporary container. It shares the
same image and environment variables as the deployed app but does not
affect running processes.
Volume configuration
Create a persistent storage directory, set the correct ownership, and mount it into the app container.
dokku storage:create ticketsplit
chown -R 32767:32767 /var/lib/dokku/data/storage/ticketsplit
dokku storage:mount ticketsplit /var/lib/dokku/data/storage/ticketsplit:/app/storage
32767 is the default Heroku user ID used inside Dokku
containers.
DATABASE_URL=/app/storage/db.sqlite as an env var so
your app points to the mounted volume.
Monorepos and subfolder
Configure the build working subdirectory Dokku uses to build for each app.
dokku builder:set app_name build-dir <subfolder>
Remove app
List all apps
Check the available Dokku apps before deleting one.
dokku apps:list
Destroy app
Remove the selected Dokku app from the VPS, then clean unused resources.
dokku apps:destroy <app_name>
dokku cleanup
docker system prune -af
Notes
Important deployment notes
$PORT environment variable.
Don't add it manually.
EXPORT in Dockerfiles.