How to setup Elasticsearch to work with Nextcloud in a docker container

Hi there,

Nextcloud has been installed on UCS 4.3 from the Univention App Center in a docker container. I would like to enable Elasticsearch and installed Elasticsearch successfully directly on the UCS server without any problems. I used the standard setup so that I can reach Elasticsearch via http://localhost:9200. However, when installing the Fulltextsearch - Elasticsearch App, there appears to be no connection to Elasticsearch outside the docker container.

When I enter the docker container via docker exec -it /bin/bash, I realize that Elasticsearch cannot be reached:

curl ‘http://localhost:9200

curl: (7) Failed to connect to localhost port 9200: Connection refused

Howerver, when accessing the UCS server directly, I receive an answer from Elasticsearch.

Could anybody give me some hints as how to make ‘http://localhost:9200’ accessible from inside the docker container which is executed on localhost?

Best regards,
Peter

The localhost in the Docker container is not the same as the localhost of the Univention host. You have to use the proper ip of the Univention system or a resolvable hostname. (and make sure that your access from within Docker is not blocked by a firewall)

Got the point. Now I bound Elasticsearch to the Public IP address and was able to reach Elasticsearch located directly on the server when initiating a request from inside the Docker container. However, I would like to keep Elasticsearch more private. What could be done to keep Elasticsearch away from the public LAN interface and to limit accessibility from inside the Docker container?

i’d try to bind the service to the docker0 interface of the UCS. This is accessible from the container.

Thank you very much for your hint. Unfortunately, I am not so familiar in network and Elasticsearch configuration. Could you give me some practical information as how to implement the suggested binding and how to address the changed binding in the Elasticsearch configuration in the Nextcloud Settings?

Mastodon