Docker image for elastic search

While creating a docker image for ES I downloaded 2.3.4 ES and changed my config file as below my-application ravi-1 node.master: true true http.port: 9200 false

and while bringing up its showing an error of

[2016-07-28 10:23:16,164][INFO ][node ] [ravi-1] starting ... Exception in thread "main" BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /]; nested: BindException[Cannot assign requested address]; Likely root cause: Cannot assign requested address at Method) at at at at at$ at at at at at org.jboss.netty.util.internal.DeadLockProofWorker$ at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at

And if I remove the config file and run with elasticsearch --networkhost _non_loopback__ is working fine. But why that error is coming for my config???
Is it ok to work with _non_loopback_ to maintain a 4 node cluster???

Using configurations like is bogus. Docker containers pick IPs from a range, so how you do know this is always the correct IP? One answer would be address wildcarding. Elasticsearch does not offer address wildcarding e.g. network.bind_host: * so you must use something like network.bind_host: or network.bind_host: 0 for this, but where behavior details (IPv4, IPv6 support) depend on the JVM implementation.

Thanks for your answer. I found out a way for taking our ip in the docker.

When I start the ES in the docker image with some flags --net=host its showing

[2016-08-01 10:54:12,454][INFO ][transport ] [ravi-1] publish_address {}, bound_addresses {}
[2016-08-01 10:54:15,572][INFO ][http ] [ravi-1] publish_address {}, bound_addresses {}

Now its taking the IP as I mentioned. But is this the correct way to mention IP or any other better ways. I want to maintain cluster a cluster of 4 nodes. Please suggest a best method to mention IP in the docker image

Is it ok to work with _non_loopback_ to maintain a 4 node cluster???

I don't see why it would be a problem.

I think you mean`hostname` because --net=host does not work here.

In the case of using hostname, you depend on the Docker container /etc/hostname setting up a working network, i.e. copying the /etc/hosts from the Docker daemon host and a working /etc/resolv.conf. Fortunately Docker is doing this behind the scenes at start of a container, e.g. pre-populating DNS resolver with Google's DNS resolver. But that can be overridden by anyone who starts a container.

On the other hand, binding to wildcard interface does not depend on any Docker network setup, it "just works"(tm).