1

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
3
  • Hi, welcome to the club J Show full logs pls
    – Yasen
    Commented Apr 30, 2020 at 8:29
  • thanks here is full logs: elasticsearch | /usr/local/bin/docker-entrypoint.sh: line 37: /usr/share/elasticsearch/chown,-R,elasticsearch,/usr/share/elasticsearch/config/: No such file or directory elasticsearch exited with code 1
    – x0rcist
    Commented Apr 30, 2020 at 12:04
  • any thoughts I have shared the edited full file.
    – x0rcist
    Commented May 2, 2020 at 23:33

1 Answer 1

1

I don't think volumes can be specified with relative paths. Put an absolute path instead of ./elastic-stack-ca.p12 and you should be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.