@dokku @docker @container

Persistent storage
Dokku's default storage mount point in the container is /storage and I have no reason to change that. On the server, you want to create a folder for your app in:

$ mkdir -p /var/lib/dokku/data/storage/<appname>
Then, you must set the permissions so that dokku and your container have access (32767 is the default container group id if you are using buildpacks:
$ sudo chown -R dokku:dokku /var/lib/dokku/data/storage/<appname>
$ sudo chown -R 32767:32767 /var/lib/dokku/data/storage/<appname>
Then just mount the storage. This command mounts your server storage directory to a folder in the container /storage.
$ dokku storage: mount <appname> /var/lib/dokku/data/storage/<appname>:/storage
If using Django, remember to configure your MEDIA_ROOT to be /storage
Check that your storage is mounted correctly, then restart the container
$ dokku storage:list <apname>
$ dokku ps:rebuild <appname>
This storage should remain mounted to the app unless you destroy and redeploy your server

Configuring nginx to serve files on Dokku persistent storage

To manually configure nginx to correctly serve your media files in the container. Copy the contents from here and paste them into a file called nginx.conf.sigil in your project root (where Procfile is). Look for loops with http and https conditionals, and before the first location / {...} statement for both http and https (where / means site root, add another location statement:

location /media/ {
alias /var/lib/dokku/data/storage/<appname>;

This will tell your nginx to serve files at from the path on the server (NOT container) that you want (in this case /var/lib/dokku/data/storage/<appname>
If using Django, remember to configure your MEDIA_URL

Telling Dokku to install a specific Python version

This is assuming you are using the official Python buildpack:
Create a file in your project root (where the Procfile is) called runtime.txt
Inside this, simply add the version of Python you want, e.g. python-3.8.2
Now, when you push your site, it will install the specific version of Python.

Add SSL certificates to your apps
First, install the letsencrypt plugin:

$ sudo dokku plugin:install
Then set your email for the certificate:
$ dokku config:set --no-restart <appname> DOKKU_LETSENCRYPT_EMAIL=<email>
or, for global email setting, do:
$ dokku config:set --no-restart --global DOKKU_LETSENCRYPT_EMAIL=<email>
Finally, set auto-renewal of certs by doing:
$ dokku letsencrypt:cron-job --add

Backing up postgres database

The general format is:

# To dump data:
$ dokku postgres:export <db_service> > <backupname>

# To import data:
$ dokku postgres:import <db_service> < <backupname>

For this you have to be using the dokku postgres plugin.