Docker bind elasticsearch volume in app folder
If you use ./ the volume will be mounted in the same folder (I have had permissions issues before by doing this just so you know)
version: "3.3"services: elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:6.1.1 volumes: - ./esdata:/usr/share/elasticsearch/data environment: - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - discovery.type=single-node ports: - "9300:9300" - "9200:9200"volumes: esdata:
Your config is almost ok but you need to use absolute path as device: ./
is causing mount of root file system instead of current directory (that's why you receive access denied)
Use absolute path in device like device: /opt/your-project/data
- please also note that directory must exist before use.