Nextcloud Collabora to Docker on DietPi (Raspberry Pi)

I have no support/technical question and have seen the support category. (Be aware that direct support questions will be deleted.)

on

Which general topic do you have

I hope this is OK to post, if not then please ignore. I simply wanted to provide some instructions that really worked for me.

I have seen many posts of issues installing nextcloud and office on a raspberry pi 4 and to be honest some of the responses have been a little difficult to understand. I have however just managed (with the help of Gemini) managed to get nextcloud and collabora working on a raspberry pi 4 with 4GB Ram. .. i’m still on a bit of a high tbh. I did this to ptimarily get rid of the ‘cURL error 28: Operation timed out’, ‘Socket proxy error / 400 Bad Request’, and ‘Temporary failure in name resolution’ errors.

The starting point is installing Nextcloud Office and the Built-in CODE server…

So here are a set of instructions which wroked for me and i hope for those who want to achieve the same end. then I hope it works for you..

How to Migrate Nextcloud Collabora to Docker on DietPi (Raspberry Pi)

This guide resolves ‘cURL error 28: Operation timed out’, ‘Socket proxy error / 400 Bad Request’, and ‘Temporary failure in name resolution’ errors by offloading document processing to Docker, properly routing WebSocket traffic through Apache, and injecting local network routing paths directly into the container.


  1. Uninstall the Built-in Server
    The built-in Nextcloud Office app (richdocumentscode_arm64) uses an AppImage that is too heavy for the Raspberry Pi 4’s CPU, leading to timeouts.

  2. Go to your Nextcloud Admin account → Apps.

  3. Find “Built-in CODE Server” and click Remove.

  4. Leave the “Nextcloud Office” app installed (this is the frontend viewer).


  1. Install Docker
  2. Open the DietPi software manager:
    sudo dietpi-software
  3. Search for or scroll to “162 Docker” (Docker: Build, ship, and run distributed applications).
  4. Select it, press Enter, and proceed with the installation.

  1. Find your Pi’s Local IP Address
    Because Docker containers operate in an isolated network environment, the Collabora container cannot use “127.0.0.1” to talk to your host’s web server. You must use your Pi’s actual local network IP.

  2. Run this command to print your Pi’s network IP:
    hostname -I

  3. Take note of the first IP address that appears (e.g., 192.168.1.50).


  1. Deploy the Collabora Docker Container
    Run the official Collabora container. Replace “YOUR_PI_IP” with the IP address from Step 3, and replace “yourdomain.com” with your actual Nextcloud domain name.

The --add-host parameter is critical—it injects the DNS mapping directly into the isolated container so it can fetch documents from Nextcloud without failing.

docker run -d -p 9980:9980 --name collabora --restart always
–add-host yourdomain.com:YOUR_PI_IP
-e “server_name=yourdomain.com”
-e “aliasgroup1=https://yourdomain.com:443”
-e “extra_params=–o:ssl.enable=false --o:ssl.termination=true”
collabora/code


  1. Enable Apache Proxy & WebSocket Modules
    Apache needs specific modules to handle the live-typing WebSocket connections. Run these commands:

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_wstunnel
sudo a2enmod rewrite


  1. Configure Apache Let’s Encrypt Rules
    You must configure Apache to securely tunnel traffic to the Docker container and prevent it from breaking the encoded URLs used by Collabora.

  2. Open your Let’s Encrypt SSL configuration file:
    sudo nano /etc/apache2/sites-available/000-default-le-ssl.conf

  3. Locate the <VirtualHost *:443> line. Immediately below it, add this rule to stop Apache from decoding slashes (which prevents “Socket connection closed unexpectedly” errors):
    AllowEncodedSlashes NoDecode

  4. Scroll down to the bottom of the block. Just above the closing tag, paste the reverse proxy rules:

    Collabora Online Reverse Proxy Rules

    Options -Indexes
    ProxyPreserveHost On

    Endpoint with information about availability of collaborative editing

    ProxyPass /hosting/discovery http://127.0.0.1:9980/hosting/discovery retry=0
    ProxyPassReverse /hosting/discovery http://127.0.0.1:9980/hosting/discovery

    Endpoint for Collabora Online capabilities

    ProxyPass /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities retry=0
    ProxyPassReverse /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities

    Main Collabora Online websocket

    ProxyPassMatch “^/cool/(.*)/ws$” ws://127.0.0.1:9980/cool/$1/ws nocanon

    Admin Console websocket

    ProxyPass /cool/adminws ws://127.0.0.1:9980/cool/adminws

    Download, Presentation and Image upload

    ProxyPass /cool http://127.0.0.1:9980/cool
    ProxyPassReverse /cool http://127.0.0.1:9980/cool

    Static browser files

    ProxyPass /browser http://127.0.0.1:9980/browser retry=0
    ProxyPassReverse /browser http://127.0.0.1:9980/browser

  5. Save the file and restart Apache:
    sudo apache2ctl configtest
    sudo systemctl restart apache2


  1. Connect Nextcloud to the New Server
  2. Go to your Nextcloud Administration Settings → Nextcloud Office.
  3. Select “Use your own server”.
  4. Enter your public domain URL (e.g., https://yourdomain.com).
  5. Click Save.

  1. Fix Host Server NAT Loopback (Host DNS Override)
    To prevent the host Nextcloud instance from getting blocked by your router when trying to execute server-to-server background tasks (like background document synchronization checks), add a local DNS override to the main OS.

  2. Open the hosts file:
    sudo nano /etc/hosts

  3. Add your domain pointing to localhost right under the standard 127.0.0.1 entry:
    127.0.0.1 yourdomain.com

  4. Save and exit.


  1. Optimize Folder Loading (Disable Document Previews)
    Generating document thumbnails on a Raspberry Pi 4 is CPU-intensive. Because Nextcloud enforces a strict 5-second deadline for thumbnails, the Pi will often hit the limit, failing and cluttering logs with “cURL error 28 (timeout)” messages. Disabling them speeds up file navigation drastically.

  2. Open your Nextcloud config file:
    sudo nano /var/www/nextcloud/config/config.php

  3. Add or modify the ‘enabledPreviewProviders’ array to exclude documents (leaving only images, text files, and videos):
    ‘enabledPreviewProviders’ =>
    array (
    0 => ‘OC\Preview\Image’,
    1 => ‘OC\Preview\Movie’,
    2 => ‘OC\Preview\TXT’,
    ),

  4. Save and exit.

If you ever need to clear out stuck processes or settings cache after configuration adjustments, run:
sudo systemctl restart php*-fpm
sudo systemctl restart apache2
docker restart collabora

That’s all there is to it