How to Destroy all Dokku Apps

Dokku, the open source Platform as a Service (PaaS) alternative, allows developers to deploy arbitrary applications to a remote server in a Heroku-like way (i.e. using Git push).

You can list current applications on the server by running the Dokku CLI

ssh root@your_server_ip
dokku apps:list

=====> My Apps
# rails-1
# rails-2

What if you want to delete them all without having to individually confirm each application?

Drop this script into your server:

#!/bin/bash
# Delete all Dokku Apps

dokku apps:list | tail -n +2 > apps.tmp
while IFS= read -r line
do
  dokku --force apps:destroy $line
done < apps.tmp
destroy_all.sh

Be sure to make it executable and then run:

./destroy_all.sh

All apps will be destroyed without confirmation. Have fun!