# Setup Elasticsearch in Docker for production

**URL:** <https://discuss.elastic.co/t/setup-elasticsearch-in-docker-for-production/195026>\
**Category:** Elasticsearch\
**Created:** [August 13, 2019, 12:44pm UTC](https://discuss.elastic.co/t/setup-elasticsearch-in-docker-for-production/195026 "2019-08-13T12:44:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomsk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomsk/32/22061_2.png) [@tomsk](https://discuss.elastic.co/u/tomsk)\
**Post date:** [August 13, 2019, 12:44pm UTC](https://discuss.elastic.co/t/setup-elasticsearch-in-docker-for-production/195026/1 "2019-08-13T12:44:50Z")

</div>

Hello, l use Elasticsearch using `docker-compose.yml`:

```
version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.16
    container_name: elasticsearch
    restart: unless-stopped
    environment:
      - "network.host=0.0.0.0"
      - "http.port=9200"
      - "cluster.name=elasticsearch"
      - "node.name=\"db-master\""
      - "node.master=true"
      - "node.data=true"
      - "bootstrap.memory_lock=true"
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 2g
    volumes:
      - esdata:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet

volumes:
  esdata:
    driver: local

networks:
  esnet:

```

This is output from `docker container ls`:

```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a2ddd5cee8dc docker.elastic.co/elasticsearch/elasticsearch:5.6.16 "/bin/bash bin/es-do…" 12 hours ago Up 12 hours 0.0.0.0:9200->9200/tcp, 9300/tcp elasticsearch

```

Problem is that, I want it to use it only on localhost, I don't want to expose Elasticsearch for public.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 10, 2019, 12:44pm UTC](https://discuss.elastic.co/t/setup-elasticsearch-in-docker-for-production/195026/2 "2019-09-10T12:44:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
