I tested your Docker file, but it just works.
FROM dockerfile/java RUN \ cd /tmp && \ wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.2.tar.gz && \ tar xvzf elasticsearch-1.3.2.tar.gz && \ rm -f elasticsearch-1.3.2.tar.gz && \ mv /tmp/elasticsearch-1.3.2 /elasticsearch
I am trying to create this Docker file and run it.
$ docker build -t 25312935 . $ docker run -t -p 9200:9200 -p 9300:9300 --rm 25312935 [2014-08-15 04:41:08,349][INFO ][node ] [Black Crow] version[1.3.2], pid[1], build[dee175d/2014-08-13T14:29:30Z] [2014-08-15 04:41:08,349][INFO ][node ] [Black Crow] initializing ... [2014-08-15 04:41:08,353][INFO ][plugins ] [Black Crow] loaded [], sites [] [2014-08-15 04:41:10,444][INFO ][node ] [Black Crow] initialized [2014-08-15 04:41:10,444][INFO ][node ] [Black Crow] starting ... [2014-08-15 04:41:10,547][INFO ][transport ] [Black Crow] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/172.17.0.72:9300]} [2014-08-15 04:41:10,560][INFO ][discovery ] [Black Crow] elasticsearch/0mpczYoYSZCiAmbkxcsfpg [2014-08-15 04:41:13,601][INFO ][cluster.service ] [Black Crow] new_master [Black Crow][0mpczYoYSZCiAmbkxcsfpg][eeb3396b1ecc][inet[/172.17.0.72:9300]], reason: zen-disco-join (elected_as_master) [2014-08-15 04:41:13,615][INFO ][http ] [Black Crow] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/172.17.0.72:9200]} [2014-08-15 04:41:13,615][INFO ][node ] [Black Crow] started [2014-08-15 04:41:13,634][INFO ][gateway ] [Black Crow] recovered [0] indices into cluster_state
As you can see below, request 127.0.0.1:9200 returns a json response.
$ curl 127.0.0.1:9200 { "status" : 200, "name" : "Black Crow", "version" : { "number" : "1.3.2", }, "tagline" : "You Know, for Search" }
Check the -p option. This means publishing a container port to host. Unless you explicitly write the host port, docker assigns a random port, as shown below.
$ docker run -t -p 9200 -p 9300 --rm 25312935 $ docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1aa4c2c84d04 25312935:latest /elasticsearch/bin/e 15 seconds ago Up 15 seconds 0.0.0.0:49153->9200/tcp, 0.0.0.0:49154->9300/tcp sad_shockley
0.0.0.0:49153->9200/tcp means that you can access the container port 9200 through the host port 49153.
$ curl 127.0.0.1:49153 { "status" : 200, "name" : "Golem", "version" : { "number" : "1.3.2", }, "tagline" : "You Know, for Search" }
So, if you want to use the host s 9200 port, explicitly write the host port like -p 9200: 9200 or -p 0.0.0.0: 9200: 9200`
$ docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES eeb3396b1ecc 25312935:latest /elasticsearch/bin/e 59 seconds ago Up 58 seconds 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp high_elion
If this still does not work, try --net=host . You can use the network stack inside the container using this option.
$ docker run -t --net=host --rm 25312935 $ curl 127.0.0.1:9200 { "status" : 200, "name" : "Black Crow", "version" : { "number" : "1.3.2", }, "tagline" : "You Know, for Search" }
If both do not work, I think you need to check your other network configuration.