Seafile server tries to connect the wrong address when working with an OnlyOffice document

Hi there,

when I’m trying to edit a document within my Seafile Docker installation with OnlyOffice (also Docker), I get the following error in the logs:

==> /var/log/onlyoffice/documentserver/docservice/out.log <==
[2019-05-08T18:57:59.892] [ERROR] nodeJS - postData error: docId = e2e36b12fb4e26002edd;url = hxxp://;data = {"key":"e2e36b12fb4e26002edd","status":1,"users":["uid-1557341879290"],"actions":[{"type":1,"userid":"uid-1557341879290"}]}
Error: connect ECONNREFUSED 188.xx.xx.xx:8000
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)

I also get a pop up message in OnlyOffice which states that the document cannot be saved. If i click “Ok” I can work in the loaded document afterwards, however if I change something, this change isn’t stored at SeaFile.

What confuses me is, that the SeaFile Docker Container tries to contact itself on port 8000 instead of the OnlyOffice container. The OnlyOffice Container is setup with a subdomain like described in the official SeaFile OnlyOffice integration tutorial.

At my file I appended the following lines and restarted the SeaFile and OnlyOffice Containers afterwards:

ONLYOFFICE_FILE_EXTENSION = (‘doc’, ‘docx’, ‘ppt’, ‘pptx’, ‘xls’, ‘xlsx’, ‘odt’, ‘fodt’, ‘odp’, ‘fodp’, ‘ods’, ‘fods’)
ONLYOFFICE_EDIT_FILE_EXTENSION = (‘docx’, ‘pptx’, ‘xlsx’)

The OnlyOffice container and the SeaFile container are sharing one public IPv4 address, resulting in and both pointing on this public address … if this does matters.

If you need more information, please let me know.

Thanks in advance

PS: A telnet on localhost or at port 8000 is also resulting in connection refused. What am I missing here?

Is this previous post relevant to your current interest?

Thanks for your answer. Your link is not addressing my problem but it gave me some hints for further searching.

I solved the problem. My OnlyOffice and my SeaFile containers are on the same host system. I’ve created a Docker network bridge dedicated for this cloud and added both containers to this network with a fixed IP address. At the creation command of the OnlyOffice container I also used the following parameter: --add-host As a result of this parameter, an entry at /etc/hosts is created within the OnlyOffice Docker container pointing mycloud.mydomain to instead of the public IP address. This means that the connection to the SeaHub on port 8000 isn’t get blocked anymore because the communication never leaves the Docker network bridge.

This sounds like a really great piece of work on your part. Perhaps you would be willing to write a short procedure of how you went about implementing the setup and post it here so that others can try it?

It sounds like it would be a significant contribution to the information we have on how to deploy Seafile Docker with OnlyOffice. This could be a huge benefit to others.

-Thank you

Sure. Basically I justed used the following (example) command to create the SeaFile Docker container:

sudo docker run -d --name seafile --net cloud --ip -e SEAFILE_SERVER_LETSENCRYPT=true -e -e -e SEAFILE_ADMIN_PASSWORD=‘MyPW’ -v /srv/seafile:/shared -p 80:80 -p 443:443 seafileltd/seafile:latest

As you can see I’m using a dedicated Docker network which is called “cloud”. I created this network before the docker create command of course. The network allows me to set fixed IP addresses for Docker containers. The IP address (which is the fixed IP address for the SeaFile Docker container in the example above) can now be used within the docker create command for the OnlyOffice container:

sudo docker run -i -t -d -p 8443:443 --name onlyoffice --net cloud --ip --add-host -v /srv/onlyoffice/logs:/var/log/onlyoffice -v /srv/onlyoffice/data:/var/www/onlyoffice/Data onlyoffice/documentserver:latest

As already stated, the --add-host parameter will set a static entry in the /etc/hosts file within the OnlyOffice container. This forces the OnlyOffice container to communicate through port 9000 over the internal Docker network (cloud) instead of going through the world wide web. An alternative would be to expose the SeaHub port 9000 at the creation of the SeaFile Docker container, but I guess that this could be considered as a security risk (at the official SeaFile Docker instructions you can’t find a word about doing so either).

I’ve created a extended tutorial recently on my blog about how to implement this setup if you need more information. Unfournatly I’m not allowed to post links here so the easiest way would be to go to my blog (unixbloggerDOTcom) and search for “SeaFile OnlyOffce”.

Hope that’s helpful for others :slight_smile:

1 Like

For those who want the step-by-step details of the procedure it can be found here.

The writing is clear, concise and easy to follow. Thank you, linuxrecon.

The above is a workaround but how can we change the port being used by onlyoffice to access the API of seafile at port 80 instead of port 8000?

In the pro docker install I see the message “Starting seahub at port 8000” and I wonder if this is realtd? But nginx is setup to serve at port 80 so OnlyOffice can’t reachport 8000 if they are on difference machines.

A workaround is to map port 8000 on the host to port 80 of the seafile docker container. But I would prefer to change the API domain name and port so it uses the internal network.

I guess seafile must send the URL for the API to OnlyOffice - but where is this configured? Thanks.

With Docker the host has a file /opt/seafile-data/seafile/conf/ccnet.conf where the URL for the API is set. Remove the port 8000 to get it using port 80 (if that is what you want)