Skip to content
Oliver Eilhard edited this page Apr 2, 2015 · 10 revisions

If you are running Elasticsearch inside a Docker container, you need to make sure that Elasticsearch returns an IP address that is accessible from outside of the container. You can do that by specifying the network.publish_host (or network.host) setting, as stated in the Elasticsearch documentation:

The network.publish_host setting allows to control the host the node will publish itself within the cluster so other nodes will be able to connect to it. Of course, this can’t be the anyLocalAddress, and by default, it will be the first non loopback address (if possible), or the local address.

The network.host setting is a simple setting to automatically set both network.bind_host and network.publish_host to the same host value.

If you don't configure your Elasticsearch inside Docker, the sniffing process won't work. You can either disable sniffing, or configure the network settings.

Here's a step-by-step guide from a user that got it to work on a Mac (#57):

  1. If you're using Boot2Docker, get the ip address of the virtual machine (boot2docker ip). If you are not using Boot2Docker, get the IP address of the machine running the Docker daemon.
  2. Grab an elasticsearch.yml config from the Elasticsearch release archive.
  3. Update the config file to set network.publish_host to the IP address from step one.
  4. Start an Elasticsearch container using your custom config file by mounting the directory containing the config file: docker run -d -v "$PWD/config":/usr/share/elasticsearch/config elasticsearch
  5. Verify that publish_address is the IP address from step one when you run curl -XGET http://<IPAddress>:9200/_nodes/http?pretty. The publish address also gets printed in the log file when starting up Elasticsearch.