Docker elasticsearch - changing directory permission is not working

Hi all

elasticsearch.yml

---
## Default Elasticsearch configuration from Elasticsearch base image.
## https://github.com/elastic/elasticsearch/blob/master/distribution/docker/src/docker/config/elasticsearch.yml
#
cluster.name: "docker-cluster"
network.host: 0.0.0.0

path.repo: ["/usr/share/elasticsearch/backup"]
## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
#

xpack.license.self_generated.type: basic
#xpack.security.enabled: true
xpack.monitoring.collection.enabled: true

docker-compose.yml

  elasticsearch:
    build:
      context: elasticsearch/
    volumes:
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - ./elasticsearch/backup01:/usr/share/elasticsearch/backup
      - type: volume
        source: data01
        target: /usr/share/elasticsearch/data
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
      ELASTIC_PASSWORD: password
      TZ: "Asia/Seoul"
      # Use single node discovery in order to disable production mode and avoid bootstrap checks.
      # see: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
      node.name: es-master01
      node.master: 'true'
      node.data: 'false'
      node.ingest: 'false'
      # Use internal Docker round-robin DNS for unicast discovery.
      discovery.seed_hosts: elasticsearch2, elasticsearch3, elasticsearch4, elasticsearch5
      # Define initial masters, assuming a cluster size of at least 3.
      cluster.initial_master_nodes: es-master01, es-master02, es-master03
      bootstrap.memory_lock: 'true'
    ulimits:
      memlock:
       soft: -1
       hard: -1
    networks:
      - elk

I added snapshot repository path (path.repo) in elasticsearch.yml and then make snapshot repository but i got error. (master is not accessible)

I searched and realized that I need to change permission on snapshot directory.(/usr/share/elasticsearch/backup)

So I entered container (docker exec -it {pid} /bin/sh), But after typing likes "chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/backup" I got error again.
(chown: changing ownership of '/usr/share/elasticsearch/bak': Operation not permitted)

dockerfile for elasticsearch

# https://www.docker.elastic.co/
FROM docker.elastic.co/elasticsearch/elasticsearch:7.13.4
RUN mkdir /usr/share/elasticsearch/backup
USER root
RUN chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/backup/
# Add your elasticsearch plugins setup here
# Example: RUN elasticsearch-plugin install analysis-icu

this one is also not working.

how can I change the directory permission?

Thank you.

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