Create and remove Dokku apps
A simple deployment checklist for creating a Dokku app, adding HTTPS, pushing code from your local machine, setting environment variables, cleaning unused Docker resources, and removing an app when needed.
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
Add HTTPS
Enable Let’s Encrypt HTTPS for all 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 prod
origin for GitHub and dokku for
deployment. If you already have a Dokku remote, remove it first with:
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 prod
Add environment variables
Set environment variables for your Dokku app.
dokku config:set <app_name> KEY=VALUE
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.
dokku apps:destroy <app_name>