I recently installed Nextcloud AIO on an Ubuntu 22.04.2 server and am having an issue where whenever I try to open any office document (such as a .odt file), it gives an error message: Document loading failed, Failed to load Nextcloud Office - please try again later. I looked around and tried to troubleshoot this, first trying some of the steps described in this page. Whenever I went into the shell of the mastercontainer and tried running curl -vvv https://$NC_DOMAIN:443/hosting/discovery, I got a simple Could not resolve host error. Then I tried commenting out a host that had the IP address 127.0.1.1, which I saw from an earlier post here was causing problems. However, restarting the mastercontainer did not change anything after this.
BTW, the docker should use bridge network for resolve the entries from /etc/hosts.
I let the DNS name resolve to local LAN ip of the host to fix the CODE server.