Issue making Nextcloud and CODE communicate with Docker

Hello!
I know this is a common issue, but I can’t find any answer around here.

I’ve got CODE and Nextcloud installed with docker. Here are the relevant parts of my compose :

  ####
  # Nextcloud
  ####
  nextcloud:
    image: linuxserver/nextcloud
    depends_on:
      redis:
        condition: service_healthy
      postgres:
        condition: service_healthy
    restart: on-failure:5
    environment:
      - PUID=1000
      - PGID=200
      - TZ=Europe/Paris
      - DOCKER_MODS=linuxserver/mods:universal-package-install|linuxserver/mods:nextcloud-notify-push
      - INSTALL_PACKAGES=libva|libva-intel-driver|intel-media-driver|mesa-va-gallium
    devices:
      - /dev/dri:/dev/dri
    volumes:
      - ./nextcloud:/config
      - /mnt/user/cloud/datas:/data
    labels:
      - traefik.enable=true
      - traefik.http.routers.nextcloud.rule=Host(`cloud.my.tld`)
      # - traefik.http.routers.nextcloud.middlewares=nc_headers
      - traefik.http.services.nextcloud.loadbalancer.server.port=443
      - traefik.http.services.nextcloud.loadbalancer.server.scheme=https
      - traefik.http.services.nextcloud.loadbalancer.serversTransport=skipVerify@file
      - ofelia.enabled=true
      - ofelia.job-exec.update-preview.schedule=@every 10m
      - ofelia.job-exec.update-preview.command=occ preview:pre-generate
    networks:
      - web
      - nextcloud-databases
  
  ####
  # CODE
  ####
  code:
    image: collabora/code
    restart: on-failure:5
    cap_add:
      - MKNOD
      - SYS_ADMIN
    ports:
      - 9980:9980
    environment:
      - domain=cloud\\.my\.tld
      - aliasgroup1=https://cloud.my.tld:443,https://cloud\\.my\\.tld:443
      - TZ=Europe/Paris
      - VIRTUAL_HOST=code.my.tld
      - server_name=code.my.tld
      - username=admin
      - password=password        # Replace with a strong password
      - dictionaries=en_GB,en_US,fr_FR
      - extra_params=
        --o:ssl.enable=false 
        --o:ssl.termination=true
        --o:logging.level=warning
        --o:user_interface.mode=compact
    labels:
      - traefik.enable=true
      - traefik.http.routers.code.rule=Host(`code.my.tld`)
      - traefik.http.services.code.loadbalancer.server.port=9980
      - traefik.http.routers.code.middlewares=middlewares-hsts@file
    networks:
      - web

I can access code.my.tld//browser/dist/admin/admin.html and login to the admin console without issues.

In Nextcloud the configuration seems good , but on the screen below, I’ve got an error :

And of course trying to open a document with Nextcloud Office doesn’t work.

I’m running CODE v24.04.13.2 and Nextcloud v31.0.2

Thanks in advance for your help

Just as an FYI, Nextcloud tells me the CODE server is reachable :

hii @foux so is it working now or document is not loading ?

No it’s not working. When trying to open a document I get this :
CleanShot 2025-04-10 at 15.09.06

Hii @foux

Can you please translate the error message to English ? :sweat_smile:

Yes, it just says

Failed loading of Nextcloud Documents - please try again later

And in the nextcloud logs, I get :

file_put_contents(/data/appdata_ocovvsbh7svp/preview/c/2/f/f/7/6/9/189003/817-1057-max.png): Failed to open stream: No such file or directory at /app/www/public/lib/private/Files/Storage/Local.php#302

Thanks

Few possible solutions:

1. Preview image error (file_put_contents(...) failed)

This error:

file_put_contents(/data/appdata_ocovvsbh7svp/preview/...): Failed to open stream: No such file or directory

…means that Nextcloud is trying to write a preview image, but the directory it expects to write to doesn’t exist.

Maybe worth to check NC forum : https://help.nextcloud.com/

2. CODE Integration / Discovery issue

Although the CODE admin panel works (code.my.tld//browser/dist/admin/admin.html), Nextcloud Office may still fail to integrate properly if:

  • Traefik is misrouting discovery or websocket paths
  • SSL termination is not properly communicated
  • The domain variable is not correctly set

Let’s double-check a few things:

domain env var

Your CODE container uses:

- domain=cloud\\.my\.tld

That’s the correct escaped version. You could also try without the escape (just to rule it out):

- domain=cloud.my.tld

Also: make sure you’re not using both VIRTUAL_HOST and traefik.* labels at the same time unless you’re using a helper like docker-gen — otherwise they can conflict.

CODE logs

Check the CODE container logs during a document open attempt:

docker logs -f <code_container_name>

You’re looking for anything like:

wsd-00000-... GET /hosting/discovery ... 404

Can CODE be reached from Nextcloud?

Enter the Nextcloud container and try:

curl -k https://code.my.tld/hosting/discovery

You should get a big XML back.

If that doesn’t work, check:

  • Traefik’s routing
  • DNS resolution (inside the container, make sure code.my.tld resolves)
  • The CODE container is really listening on port 9980 and receiving TLS-terminated traffic (which seems to be the case)

Thanks
Darshan

Tried with and without escaping, same result. We are agreeing that this variable should contain the Nextcloud host, right? Not the CODE one?

Removed the VIRTUAL_HOST env, same result

No 404. This is all I get when trying to open a document :

code-1  | wsd-00001-00018 2025-04-10 15:37:09.013131 +0200 [ asyncdns ] WRN  Waking up dead poll thread [main], started: false, finished: false| net/Socket.hpp:826
code-1  | wsd-00001-00001 2025-04-10 15:37:09.013169 +0200 [ coolwsd ] WRN  Waking up dead poll thread [main], started: false, finished: false| net/Socket.hpp:826
code-1  | frk-00020-00041 2025-04-10 15:37:10.023400 +0200 [ subforkit_001 ] WRN  The systemplate directory [/opt/cool/systemplate] is read-only, and at least [/opt/cool/systemplate//etc/passwd] is out-of-date. Will have to clone dynamic elements of systemplate to the jails. To restore optimal performance, make sure the files in [/opt/cool/systemplate/etc] are up-to-date.| common/JailUtil.cpp:587
code-1  | frk-00020-00041 2025-04-10 15:37:10.026691 +0200 [ subforkit_001 ] WRN  The systemplate directory [/opt/cool/systemplate] is read-only, and at least [/opt/cool/systemplate//etc/passwd] is out-of-date. Will have to clone dynamic elements of systemplate to the jails. To restore optimal performance, make sure the files in [/opt/cool/systemplate/etc] are up-to-date.| common/JailUtil.cpp:587
code-1  | frk-00020-00041 2025-04-10 15:37:10.029804 +0200 [ subforkit_001 ] WRN  The systemplate directory [/opt/cool/systemplate] is read-only, and at least [/opt/cool/systemplate//etc/passwd] is out-of-date. Will have to clone dynamic elements of systemplate to the jails. To restore optimal performance, make sure the files in [/opt/cool/systemplate/etc] are up-to-date.| common/JailUtil.cpp:587
code-1  | frk-00020-00041 2025-04-10 15:37:10.032669 +0200 [ subforkit_001 ] WRN  The systemplate directory [/opt/cool/systemplate] is read-only, and at least [/opt/cool/systemplate//etc/passwd] is out-of-date. Will have to clone dynamic elements of systemplate to the jails. To restore optimal performance, make sure the files in [/opt/cool/systemplate/etc] are up-to-date.| common/JailUtil.cpp:587
code-1  | frk-00020-00041 2025-04-10 15:37:10.035860 +0200 [ subforkit_001 ] WRN  The systemplate directory [/opt/cool/systemplate] is read-only, and at least [/opt/cool/systemplate//etc/passwd] is out-of-date. Will have to clone dynamic elements of systemplate to the jails. To restore optimal performance, make sure the files in [/opt/cool/systemplate/etc] are up-to-date.| common/JailUtil.cpp:587

Yep that works, I can get it from inside my nextcloud container.

Thanks again for your big help.

Is there a way to try directly from CODE to edit a file? Just to see if it’s working this way.

Thanks

Try CODE standalone via WOPI test pages (admin interface)

CODE includes a simple test interface you can use to open local files or URLs. Here’s how:

:white_check_mark: Access CODE’s admin interface:

https://code.my.tld/browser/dist/admin/admin.html

You mentioned earlier that you can already log in here — great.

Direct CODE test page (document loader)

Once logged in as admin, go to this page:t

https://code.my.tld/loleaflet/dist/admin/test.html

This is a built-in tool for testing CODE without needing Nextcloud or any WOPI host.

More details : Installation Guide — SDK https://sdk.collaboraonline.com/ documentation

Cheers
Darshan

Thanks. This one gives me a 400 error, with the following logs :

code-1  | wsd-00001-00028 2025-04-10 17:58:13.565061 +0200 [ websrv_poll ] WRN  #30: Unknown resource: /loleaflet/dist/admin/test.html G, host: code.my.tld, path: 4
code-1  | [0] 'loleaflet'
code-1  | [1] 'dist'
code-1  | [2] 'admin'
code-1  | [3] 'test.html'
code-1  | full URI: /loleaflet/dist/admin/test.html| wsd/ClientRequestDispatcher.cpp:940
code-1  | wsd-00001-00028 2025-04-10 17:58:13.612857 +0200 [ websrv_poll ] WRN  #32: Unknown resource: /apple-touch-icon-precomposed.png G, host: code.my.tld, path: 1
code-1  | [0] 'apple-touch-icon-precomposed.png'
code-1  | full URI: /apple-touch-icon-precomposed.png| wsd/ClientRequestDispatcher.cpp:940
code-1  | wsd-00001-00028 2025-04-10 17:58:13.612932 +0200 [ websrv_poll ] WRN  #30: Unknown resource: /apple-touch-icon.png G, host: code.my.tld, path: 1
code-1  | [0] 'apple-touch-icon.png'
code-1  | full URI: /apple-touch-icon.png| wsd/ClientRequestDispatcher.cpp:940
code-1  | wsd-00001-00028 2025-04-10 17:58:14.270313 +0200 [ websrv_poll ] WRN  #31: Unknown resource: /loleaflet/dist/admin/test.html G, host: code.my.tld, path: 4
code-1  | [0] 'loleaflet'
code-1  | [1] 'dist'
code-1  | [2] 'admin'
code-1  | [3] 'test.html'
code-1  | full URI: /loleaflet/dist/admin/test.html| wsd/ClientRequestDispatcher.cpp:940

Lucky I found this thread. I am in the same boat, trying to get Collabora to work with my Nextcloud for two days now.

My set-up is differnet, though:

  • Traefik is set-up in a DMZ vLAN and is correctly working to serve my NextCloud and other services
  • Nextcloud is not running in a container but in my backend vlan
  • Collabora/CODE is also ruinning in the DMZ Docker construction behind traefik
  • My Nextcloud and Collabora (CODE) can also see each other and talk to each other (mostly .. .see below). Also my CODE Admin Page is accessible.
  • When I try to create/open an office document in NextCloud I can see a lot of movement in the Collabora Docker Container (on debug) which finally stops with
  • CheckFileInfo request is in progress. Will resume when done| wsd/RequestVettingStation.cpp:319
  • It will then wait (while NexctCloud shows spinning icon) and go into a timeout (60 s) leaving me with (sensitive data reducted)
CheckTimeout: Timeout while requesting [GET nextcloud.<mydomain>/index.php/apps/richdocuments/wopi/files/<...>&access_token_ttl=0] after 64101ms| net/HttpRequest.hpp:1773
 WOPI::CheckFileInfo failed for URI [https://nextcloud.<mydomain>/index.php/apps/richdocuments/wopi/files/<...>&access_token_ttl=0]: 0 (Unknown) . Headers:       Body: []| wsd/wopi/CheckFileInfo.cpp:100
Invalid URI or access denied to [https://nextcloud.<mydomain>/index.php/apps/richdocuments/wopi/files/<...>&access_token_ttl=0]| wsd/wopi/CheckFileInfo.cpp:118
SslStreamSocket::shutdownConnection() #31| net/SslSocket.hpp:136
Closed socket Socket[#31, IPv4 @ :0]| net/Socket.hpp:171

I checked Firewall and opened everything for tests and I can actually curl the URI in question from within the collabora docker container. This curl is then waiting what seems indefinitely after having received the Inital Documetns meta data … I have to ctrl-.c to stop the curl.

All in all something is blocking or not “fully” allowing the call back from Collabora to NextCloud. Any ideas? Maybe on the Nextcloud side of thing, which shows nothing enlightening in the logs?