# Detach node from a cluster in docker

**URL:** <https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [April 21, 2021, 6:25pm UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896 "2021-04-21T18:25:48Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![bentleg1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentleg1/32/87527_2.png) [@bentleg1](https://discuss.elastic.co/u/bentleg1)\
**Post date:** [April 21, 2021, 6:25pm UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/1 "2021-04-21T18:25:48Z")

</div>

Hello everyone!

I have a little question about the elasticsearch-node tool: Is it possible to use it in any way to detach a node from a cluster that exists in a docker container?

So far the tool throws an exception that a node cannot be detached if it is still running, which sounds reasonable. I tried shutting down the node inside the container, but it results in the container being shut down.

Thanks in advance for your answers!

---

<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:** [April 21, 2021, 10:39pm UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/2 "2021-04-21T22:39:46Z")

</div>

Welcome to our community! 😃

What are you trying to achieve with this?

---

<div class="post-metadata">

**Author:** ![bentleg1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentleg1/32/87527_2.png) [@bentleg1](https://discuss.elastic.co/u/bentleg1)\
**Post date:** [April 22, 2021, 5:22am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/3 "2021-04-22T05:22:20Z")

</div>

Hi Mark.  
Because i lost all master nodes and want recollect cluster.

---

<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:** [April 22, 2021, 5:30am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/4 "2021-04-22T05:30:32Z")

</div>

If you have lost all masters then you have lost the cluster, there is no recovering unless you have a backup.

---

<div class="post-metadata">

**Author:** ![bentleg1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentleg1/32/87527_2.png) [@bentleg1](https://discuss.elastic.co/u/bentleg1)\
**Post date:** [April 22, 2021, 5:36am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/5 "2021-04-22T05:36:10Z")

</div>

But all my data nodes are still alive. And i suppose that this command can help to me to add my fata node to new mater node.  
"elasticsearch-node detach-cluster"

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 22, 2021, 5:42am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/6 "2021-04-22T05:42:52Z")

</div>

You cannot attach a data node to a new master. If you have lost all master nodes and can not bring them back up you need to recreate the cluster and restore data from a snapshot.

---

<div class="post-metadata">

**Author:** ![bentleg1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentleg1/32/87527_2.png) [@bentleg1](https://discuss.elastic.co/u/bentleg1)\
**Post date:** [April 22, 2021, 5:54am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/7 "2021-04-22T05:54:01Z")

</div>

I don't have any backup.  
And this article says me that i can try to restore my data

> **[elasticsearch-node | Elasticsearch Guide \[7.12\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/node-tool.html#node-tool-detach-cluster)**

But i can't run this command from docker container.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 22, 2021, 6:18am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/8 "2021-04-22T06:18:31Z")

</div>

Can't you attach to the container in order to run the command?

---

<div class="post-metadata">

**Author:** ![bentleg1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentleg1/32/87527_2.png) [@bentleg1](https://discuss.elastic.co/u/bentleg1)\
**Post date:** [April 22, 2021, 6:33am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/9 "2021-04-22T06:33:14Z")

</div>

To run command i need stop elasticsearch service. But when i stopping service docker container is closed...

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 22, 2021, 6:37am UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/10 "2021-04-22T06:37:29Z")

</div>

Ah yes, that is true. Then I do not think you can recover the data in the cluster.

---

<div class="post-metadata">

**Author:** ![bentleg1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentleg1/32/87527_2.png) [@bentleg1](https://discuss.elastic.co/u/bentleg1)\
**Post date:** [April 23, 2021, 1:26pm UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/11 "2021-04-23T13:26:51Z")

</div>

```
 docker run --name detach -p 9200:9200 -p 9300:9300 -v /your_volume_with_elastic_data -v /your__elastic_config -it **--entrypoint /bin/bash** elasticsearch:7.10.1

```

This right command to run docker. After that you can run bin/elasticsearch-nodes detach-cluster or other similar commands.

---

<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:** [May 21, 2021, 1:27pm UTC](https://discuss.elastic.co/t/detach-node-from-a-cluster-in-docker/270896/12 "2021-05-21T13:27:21Z")

</div>

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