Run elasticsearch with docker

I am new with elasticsearch so pardon me if my question is stupid. I am try to run it with docker. After i pulled elasticsearch image from docker hub, i ran it with command:

docker run -p 9200:9200 -p 9300:9300 --name=ES elasticsearch

  • Why does docker overwrite everything I've installed?
  • Run a hadoop cluster on docker containers
  • “tag latest not found” on docker pull with private registry
  • nginx and php-fpm in Docker
  • How to use RUN clone git in dockerfile
  • Unable to start Oracle listener in Docker Oracle on Red Hat
  • But when i opened http://192.168.99.100:9200 (my docker-machine ip is 192.168.99.100) the page is not available.

    I tried to change my elasticsearch.yml like below:

    network.publish_host: 192.168.99.100

    but it doesn’t work. Anyone help me out?

    Thanks.

    update 1

    I try pass the network.publish_host setting directly on the command line with --network.publish_host=192.168.99.100 (as @Val mentioned) but it still not working. Here the log:

    $ docker run -p 9200:9200 -p 9300:9300 --name=ES elasticsearch  --network.publish_host=192.168.99.100
    [2015-10-31 05:18:57,305][INFO ][node                     ] [Slipstream] version[2.0.0], pid[1], build[de54438/2015-10-22T08:09:48Z]
    [2015-10-31 05:18:57,306][INFO ][node                     ] [Slipstream] initializing ...
    [2015-10-31 05:18:57,445][INFO ][plugins                  ] [Slipstream] loaded [], sites []
    [2015-10-31 05:18:57,655][INFO ][env                      ] [Slipstream] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/sda1)]], net usable_space [11.5gb], net total_space [18.1gb], spins? [possibly], types [ext4]
    [2015-10-31 05:19:01,778][INFO ][node                     ] [Slipstream] initialized
    [2015-10-31 05:19:01,784][INFO ][node                     ] [Slipstream] starting ...
    [2015-10-31 05:19:02,072][INFO ][transport                ] [Slipstream] publish_address {192.168.99.100:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
    [2015-10-31 05:19:02,140][INFO ][discovery                ] [Slipstream] elasticsearch/D9frl4aqQlG_ihimJ6eY_w
    [2015-10-31 05:19:05,309][INFO ][cluster.service          ] [Slipstream] new_master {Slipstream}{D9frl4aqQlG_ihimJ6eY_w}{192.168.99.100}{192.168.99.100:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
    [2015-10-31 05:19:05,370][INFO ][http                     ] [Slipstream] publish_address {192.168.99.100:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
    [2015-10-31 05:19:05,373][INFO ][node                     ] [Slipstream] started
    [2015-10-31 05:19:05,496][INFO ][gateway                  ] [Slipstream] recovered [0] indices into cluster_state
    

  • Check that Docker container has enough disk space
  • Jackrabbit with PostgreSQL backend leaves repository in inconsistent state
  • Docker copy command to copy a jar file from target folder
  • Why did my Docker Container did not work when the container UID is missing on the host?
  • Run AspNet Core app in docker using GMSA
  • Docker MySQL: create new user
  • One Solution collect form web for “Run elasticsearch with docker”

    Since the OP is using Mac, the port 9200 needs to be port forwarded (with boot2docker or with docker machine) at the VM (VirtualBox) level.

    VBoxManage controlvm "boot2docker-vm" --natpf1 "tcp-port9200 ,tcp,,9200,,9200"
    VBoxManage controlvm "boot2docker-vm" --natpf1 "udp-port9200 ,udp,,9200,,$9200
    

    (controlvm if the VM is running, modifyvm is the VM is stopped)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.