# Stop elasticsearch from within a container

**URL:** <https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [January 18, 2021, 5:11pm UTC](https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455 "2021-01-18T17:11:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cinemafunk](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@cinemafunk](https://discuss.elastic.co/u/cinemafunk)\
**Post date:** [January 18, 2021, 5:11pm UTC](https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455/1 "2021-01-18T17:11:35Z")

</div>

I'm launched Graylog, MongoDB, and Elasticsearch docker container stack on a VM. My goal is to move my currently running Graylog instance from a manually installed Graylog instance from an Ubuntu VM, to another Ubtunu VM using these Docker containers for a more lightweight, modular setup. I used the Graylog 4.0 docker install steps from Graylog docs: [https://docs.graylog.org/en/4.0/pages/installation/docker.html](https://docs.graylog.org/en/4.0/pages/installation/docker.html), which uses the Elasticsearch docker install: [https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docker.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docker.html)

I have a snapshot of my elasticsearch data sent to the /backup directory within my elasticsearch container. I've added path.repo: /backup to my elasticsearch.yml file, and then restarted the container.

When I run:  
`curl -X PUT -H "content-type:application/json" 'localhost:9200/_snapshot/snapshot' -d '{"type":"fs","settings":{"location":"/backup","compress":true}}'`

I get:  
`{"error":{"root_cause":[{"type":"exception","reason":"failed to create blob container"}],"type":"repository_verification_exception","reason":"[snapshot] path is not accessible on master node","caused_by":{"type":"exception","reason":"failed to create blob container","caused_by":{"type":"access_denied_exception","reason":"/backup/tests-zZCKO31iRYSYni03DdEwgA"}}},"status":500}`

I believe this is because elassticsearch is running. If so, I need to stop the elasticsearch service. But how do I do that from within the container?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 18, 2021, 10:31pm UTC](https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455/2 "2021-01-18T22:31:42Z")

</div>

Welcome to our community! 😃

What is the output from `GET _snapshot/`?

---

<div class="post-metadata">

**Author:** ![cinemafunk](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@cinemafunk](https://discuss.elastic.co/u/cinemafunk)\
**Post date:** [January 20, 2021, 9:46pm UTC](https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455/3 "2021-01-20T21:46:45Z")

</div>

Thank you for your welcome.

And the answer to your question:  
`[root@3107e4c11987 elasticsearch]# curl -X GET localhost:9200/_snapshot {"snapshot":{"type":"fs","settings":{"compress":"true","location":"/backup"}}}[root@3107e4c11987 elasticsearch]`

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 20, 2021, 9:47pm UTC](https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455/4 "2021-01-20T21:47:34Z")

</div>

Thanks, what are the permissions on that directory?

---

<div class="post-metadata">

**Author:** ![cinemafunk](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@cinemafunk](https://discuss.elastic.co/u/cinemafunk)\
**Post date:** [January 22, 2021, 12:25pm UTC](https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455/5 "2021-01-22T12:25:17Z")

</div>

Whelp, guess what I forgot to do this entire time!

After I changed the directory permissions to elasticsearch, I did get the following:

```auto
[root@3107e4c11987 /]# curl -XPUT -H "content-type:application/json" 'http://localhost:9200/_snapshot/snapshot' -d '{"type":"fs","settings":{"location":"/backup","compress":true}}'
{"acknowledged":true}

```

I was then able to delete pre-existing indices, restore, restart, and bring up graylog with all my data. Glad to know that I'm ready to migrate my server over.

---

<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:** [February 19, 2021, 12:25pm UTC](https://discuss.elastic.co/t/stop-elasticsearch-from-within-a-container/261455/6 "2021-02-19T12:25:20Z")

</div>

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