Skip to content

Instantly share code, notes, and snippets.

@alphamarket
Created August 8, 2021 20:17
Show Gist options
  • Save alphamarket/f07d1900e58eef694bf56896849107f2 to your computer and use it in GitHub Desktop.
Save alphamarket/f07d1900e58eef694bf56896849107f2 to your computer and use it in GitHub Desktop.
Install and use ElasticSearch with limited resources using docker
# follow `https://www.elastic.co/guide/en/kibana/current/docker.html#run-kibana-on-docker-for-dev` instructions for
# installing ES using docker
function run-docker-es() {
# remove any already running es instance
docker ps -af "name=elasticsearch" -q 2>/dev/null | xargs docker rm &>/dev/null
# launch the ES with 1GB memory limit and 3 core
docker run --name elasticsearch \
--net elastic \
-p 9200:9200 \
-p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms1g -Xmx1g" \
--memory 1g \
--memory-swap -1 \
--cpus 3 docker.elastic.co/elasticsearch/elasticsearch:7.14.0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment