I have came across this question which is very similar,
Docker bind elasticsearch volume in app folder
and here’s one the answer:
https://stackoverflow.com/a/69441244
They suggested in the docker-compose file in the volumes I need to give,
./esdata which means current directory. But the answer says we need to give permissions 1000:1000 and username is elasticsearch:elasticsearch.
How can I create that permission and username. In my linux system I have a personal user name called ubuntu and a root. I don’t have a user called elasticsearch. Please help me out.
services:
elasticsearch:
# Elasticsearch Instance
container_name: gs-search
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
volumes:
# Persist ES data in seperate "esdata" volume
- ./esdata:/usr/share/elasticsearch/data
environment:
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms6g -Xmx6g"
- discovery.type=single-node
- xpack.security.enabled=true
- ELASTIC_PASSWORD=$ELASTIC_PASSWORD
ulimits:
memlock:
soft: -1
hard: -1
ports:
# Expose Elasticsearch ports
- "9301:9300"
- "9201:9200"