Skip to content

Instantly share code, notes, and snippets.

@davefreiman
Last active November 12, 2018 13:23
Show Gist options
  • Save davefreiman/79e1908f31d8b3e6bc165bb3124b0627 to your computer and use it in GitHub Desktop.
Save davefreiman/79e1908f31d8b3e6bc165bb3124b0627 to your computer and use it in GitHub Desktop.
Elasticsearch docker setup

Make sure to login to docker hub before getting started

$ docker login

# pull repo from docker hub
$ docker pull elasticsearch:latest

# run the container
# --name option is the reference for the container so that you can start and stop it after the initial run
# -p option are the ports to map the running container to. I use 127.0.0.1:9200 explicitly and supply :9200 as an extra precaution.
# -d is the image to run - the one you just downloaded above
$ docker run --name elasticsearch_latest -p 127.0.0.1:9200:9200 -d elasticsearch:latest

$ docker ps
# > container info for elasticsearch

$ curl -i localhost:9200

# you can stop the container now
$ docker stop elasticsearch_latest

# or start it
$ docker start elasticsearch_latest

# or list all containers (started or stopped)
$ docker ps -a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment