How can I secure elasticsearch for production use in Docker?
I use this 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=-Xms6g -Xmx6g"
- xpack.security.enabled=false
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 12g
volumes:
- esdata:/usr/share/elasticsearch/data
ports:
- 127.0.0.1:9200:9200
networks:
- esnet
volumes:
esdata:
driver: local
networks:
esnet:
I want elasticsearch to be accessible only on localhost network (only local apps should access it), so it shouldn't be accessible from internet. I use bind to localhost - 127.0.0.1:9200:9200, but I don't know if it is enough.