Below is except of my docker-compose.yml file
I am trying to mount from host file inside the container, which works i.e. able to mount but then I need to give it permission (my clumsy chown command, below).
I am not sure where to run it as wherever I place my (command: chown,-R,elasticsearch,/usr/share/elasticsearch/config/)
It gives me error that 'no such file or directory' which I think: my code run before volume is attached.
I tried placing it after container_name as well, same 'no such file or directory'
Any advise how to do it?
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch
volumes:
- ./elastic-stack-ca.p12:/usr/share/elasticsearch/config/elastic-stack-ca.p12
- esdata1:/usr/share/elasticsearch/data
*command: chown,-R,elasticsearch,/usr/share/elasticsearch/config/*
Here is full yml, if it is helpful
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
container_name: elasticsearch
command:
chown,-R,elasticsearch,/usr/share/elasticsearch/config/
environment:
- node.name=elasticsearch
- discovery.seed_hosts=elasticsearch
- cluster.initial_master_nodes=elasticsearch
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ./elastic-stack-ca.p12:/usr/share/elasticsearch/config/elastic-stack-ca.p12
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
kibana:
image: docker.elastic.co/kibana/kibana:7.6.2
container_name: kibana
environment:
ELASTICSEARCH_URL: "http://elasticsearch:9200"
ELASTICSEARCH_USERNAME: "kibana"
ELASTICSEARCH_PASSWORD: "kibana"
ports:
- 5601:5601
depends_on:
- elasticsearch
volumes:
esdata1:
driver: local