# External Docker Volume for Elasticsearch Snapshot

**URL:** <https://discuss.elastic.co/t/external-docker-volume-for-elasticsearch-snapshot/191598>\
**Category:** Elasticsearch\
**Created:** [July 22, 2019, 7:46am UTC](https://discuss.elastic.co/t/external-docker-volume-for-elasticsearch-snapshot/191598 "2019-07-22T07:46:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alza/32/50143_2.png) [@alza](https://discuss.elastic.co/u/alza)\
**Post date:** [July 22, 2019, 7:46am UTC](https://discuss.elastic.co/t/external-docker-volume-for-elasticsearch-snapshot/191598/1 "2019-07-22T07:46:22Z")

</div>

I'm trying to use snapshot for backup and restore, I added the backup path in `elasticsearch.yml` as:

```auto
path.repo: ["/opt/elasticsearch/backup"]

```

Also in my elasticsearch `docker-compose.yml` I bind this path to an external volume as:

```auto
version: '2'

services:

  elasticsearch:
    build:
      context: elasticsearch/
      args:
        ELK_VERSION: 7.2.0
    volumes:
      - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
      - elastic_data:/usr/share/elasticsearch/data
      - elastic_data_backup:/opt/elasticsearch/backup
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx1g -Xms1g"
      ELASTIC_PASSWORD: changeme
    networks:
      - elk

networks:
  elk:
    driver: bridge

volumes:
  elastic_data:
    external: true
  elastic_data_backup:
    external: true

```

Now, to create an snapshot, first:

```auto
PUT /_snapshot/my-snapshot
{
  "type": "fs",
  "settings": {
    "compress" : true,
    "location": "/opt/elasticsearch/backup"
  }
}

```

but when I use this command to create snapshot:

```auto
PUT /_snapshot/my-snapshot/backup_1?wait_for_completion=true

```

I get the following error:

```auto
{"error":"RepositoryVerificationException[[es_backup] path is not accessible on master node]; nested: FileNotFoundException[/opt/elasticsearch/backup/tests-Y1AbUndPQ_O1je_zyFGa1Q-master (Permission denied)]; ","status":500}

```

Following this [link](https://blog.leandot.com/2017/03/04/create-elastic-search-snapshot-docker.html) I could resolved the issue by changing the folders ownership as follows:

```auto
# Change the ownership of user-mutable directories to elasticsearch
for path in \
	/usr/share/elasticsearch/data \
	/usr/share/elasticsearch/logs \
	/opt/elasticsearch/backup \
; do
	chown -R elasticsearch:elasticsearch "$path"
done

```

But I wonder if there is a better workaround, and is the above method safe!? or it may break some functionalities of Elasticsearch!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 19, 2019, 7:46am UTC](https://discuss.elastic.co/t/external-docker-volume-for-elasticsearch-snapshot/191598/2 "2019-08-19T07:46:28Z")

</div>

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