This involves the use of the official Nextcloud Docker Image that runs apache within the container.

Set up the app:

dokku apps:create mycloud
sudo docker pull nextcloud:latest
sudo docker tag nextcloud:latest dokku/mycloud:latest
sudo mkdir -p /var/lib/dokku/data/storage/mycloud
sudo chown -R dokku:dokku /var/lib/dokku/data/storage/mycloud
dokku storage:mount mycloud /var/lib/dokku/data/storage/mycloud:/var/www/html
dokku tags:deploy mycloud latest
dokku config:set mycloud --no-restart DOKKU_LETSENCRYPT_EMAIL=myemail@email.example
dokku letsencrypt mycloud

dokku postgres:create mycloud_db
dokku postgres:link mycloud_db mycloud

Then go to the URL for your mycloud app (e.g. https://mycloud.example.tld) and set up the admin user and postgres credentials. Run dokku postgres:info mycloud_db on your server to get those credentials, which will look something like this: postgres://<USER>:<PASSWORD>@<HOST>:5432/<DATABASE>

If all goes well, continue on to setup redis:

dokku redis:create mycloud
dokku redis:link mycloud mycloud

Run dokku redis:info mycloud to get the redis credentials, which should look something like: redis://mycloud:<REDIS_HOST_PASSWORD>@<REDIS_HOST>:6379

dokku config:set mycloud REDIS_HOST=dokku.redis.mycloud REDIS_HOST_PASSWORD=<REDIS_HOST_PASSWORD>

(Optional) Set up SMTP:

dokku config:set mycloud SMTP_SECURE=ssl SMTP_AUTHTYPE=PLAIN SMTP_NAME=myemail@email.example SMTP_PASSWORD=supersecret MAIL_FROM_ADDRESS=myemail@email.example MAIL_DOMAIN=mycloud.example.tld

sudo su - dokku
mkdir /home/dokku/mycloud/nginx.conf.d/
echo 'client_max_body_size 2048m;' > /home/dokku/mycloud/nginx.conf.d/upload.conf
sudo service nginx reload

Collabora Online not working due to mixed content error:

I ran into an annoying issue where the Collabora rich text editor doesn't work because it tries to load an HTTP address instead of an HTTPS one, leading to a mixed content error (which prevents loading insecure resources).

This workaround suggested by mschoeffmann is eventually what worked for me.

The steps I did were:

# enforce ssl protocol
dokku config:set mycloud OVERWRITEPROTOCOL=https

Then edit /var/lib/dokku/data/storage/mycloud/.htaccess to contain SetEnv HTTPS on:


SetEnv HTTPS on
ErrorDocument 403 //
ErrorDocument 404 //

Then restart the app:

dokku ps:restart mycloud

CalDAV and Contacts Internal Server Error

This happened on my instance because app data folders needed to be updated.

dokku enter mycloud
apt update -y && apt install -y sudo
sudo -u www-data php occ files:scan-app-data