Permission error while trying to access file which is under mounted volume

I cant access the files that are in mounted volume

elasticsearch    | {"type": "server", "timestamp": "2022-08-25T07:52:51,332Z", "level": "ERROR", "component": "o.e.b.ElasticsearchUncaughtExceptionHandler", "cluster.name": "docker-cluster", "node.name": "elasticsearch", "message": "uncaught exception in thread [main]",
elasticsearch    | "stacktrace": ["org.elasticsearch.bootstrap.StartupException: java.security.AccessControlException: access denied (\"java.io.FilePermission\" \"/usr/share/elasticsearch/cert\" \"read\")",

here is my docker compose file

version: '2.2'

services:

  elasticsearch:
    image: elastic:7.9.2
    container_name: elasticsearch
    environment:
      - node.name=elasticsearch
      - discovery.seed_hosts=elasticsearch
      - cluster.initial_master_nodes=elasticsearch
      - cluster.name=docker-cluster
      - network.host=0.0.0.0
      - "ES_JAVA_OPTS=-Xms4g -Xmx4g"
      - ELASTIC_PASSWORD=1@123
      - path.logs=/usr/share/elasticsearch/logs
      - xpack.security.enabled=true
      - xpack.security.http.ssl.keystore.path=/usr/share/elasticsearch/cert/elastic-certificates.p12
      - xpack.security.http.ssl.truststore.path=/usr/share/elasticsearch/cert/elastic-certificates.p12
      - xpack.security.http.ssl.client_authentication=optional
    volumes:
      - /home/elasticsearch/data:/usr/share/elasticsearch/data
      - /home/elasticsearch/logs:/usr/share/elasticsearch/logs
      - /home/elasticsearch/config:/usr/share/elasticsearch/cert

    user : "1000:1000"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: "65536"
        hard: "65536"
    ports:
      - 9200:9200
      - 9300:9300

  kibana:
    image: kibana:7.9.2
    container_name: kibana
    environment:
            - ELASTICSEARCH_URL="https://elasticsearch:9200"
            - ELASTICSEARCH_USERNAME=elastic
            - ELASTICSEARCH_PASSWORD=1@123
            - server.ssl.enabled=true
            - server.ssl.certificate=/usr/share/elasticsearch/cert/newfile.crt.pem
            - server.ssl.key=/usr/share/elasticsearch/cert/newfile.key.pem
            - elasticsearch.ssl.verificationMode=none
    ports:
      - 5601:5601
    depends_on:
      - elasticsearch
    volumes:
      - /home/elasticsearch/config:/usr/share/elasticsearch/cert

creating new folder was cause of the permission error, instead of mounting folder, I mount files and problem solved.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.