# CrateDB cluster using docker doesn't form

**URL:** <https://community.cratedb.com/t/cratedb-cluster-using-docker-doesnt-form/1507>\
**Category:** CrateDB\
**Created:** [June 6, 2023, 7:17am UTC](https://community.cratedb.com/t/cratedb-cluster-using-docker-doesnt-form/1507 "2023-06-06T07:17:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cocoa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/cocoa/32/783_2.png) [@cocoa](https://community.cratedb.com/u/cocoa)\
**Post date:** [June 6, 2023, 7:17am UTC](https://community.cratedb.com/t/cratedb-cluster-using-docker-doesnt-form/1507/1 "2023-06-06T07:17:21Z")

</div>

Hello,

I’m trying to build a CrateDB cluster using docker and the host type network, to use the subnet where the three host machines are connected.

I use these commands, each on a single host:  
host1  
`docker run -d --name crate1 --net=host --env CRATE_HEAP_SIZE=2g --env CRATE_CLUSTER_NAME=my_cluster --env CRATE_DISCOVERY_SEEDS=10.0.0.2,10.0.0.3 crate`

host2  
`docker run -d --name crate2 --net=host --env CRATE_HEAP_SIZE=2g --env CRATE_CLUSTER_NAME=my_cluster --env CRATE_DISCOVERY_SEEDS=10.0.0.1,10.0.0.3 crate`

host3  
`docker run -d --name crate3 --net=host --env CRATE_HEAP_SIZE=2g --env CRATE_CLUSTER_NAME=my_cluster --env CRATE_DISCOVERY_SEEDS=10.0.0.1,10.0.0.2 crate`

I’m trying to build a CrateDB cluster using docker and the host type network, to use the subnet where the three host machines are connected.

I use these commands, each on a single host, three instances of cratedb are created but all as master and no cluster is formed.

Do you have a suggestion of how to create the cluster in this way (docker with --net host)?

Thank you.

Luca

---

<div class="post-metadata">

**Author:** ![hernanc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hernanc/32/676_2.png) [@hernanc](https://community.cratedb.com/u/hernanc)\
**Post date:** [June 6, 2023, 8:54am UTC](https://community.cratedb.com/t/cratedb-cluster-using-docker-doesnt-form/1507/2 "2023-06-06T08:54:14Z")

</div>

Hi,  
You would need to change your commands into something like:

```bash
docker run -d --name crate1 --net=host --env CRATE_HEAP_SIZE=2g crate -Ccluster.name=my_cluster -Cdiscovery.seed_hosts=10.0.0.2,10.0.0.3 -Ccluster.initial_master_nodes=10.0.0.1,10.0.0.2,10.0.0.3

docker run -d --name crate2 --net=host --env CRATE_HEAP_SIZE=2g crate -Ccluster.name=my_cluster -Cdiscovery.seed_hosts=10.0.0.1,10.0.0.3 -Ccluster.initial_master_nodes=10.0.0.1,10.0.0.2,10.0.0.3

docker run -d --name crate3 --net=host --env CRATE_HEAP_SIZE=2g crate -Ccluster.name=my_cluster -Cdiscovery.seed_hosts=10.0.0.1,10.0.0.2 -Ccluster.initial_master_nodes=10.0.0.1,10.0.0.2,10.0.0.3

```

Please note that for security reasons you should configure your network so that the CrateDB cluster nodes are only reachable on port 4300 from other CrateDB nodes in the cluster.

---

<div class="post-metadata">

**Author:** ![cocoa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/cocoa/32/783_2.png) [@cocoa](https://community.cratedb.com/u/cocoa)\
**Post date:** [June 6, 2023, 3:57pm UTC](https://community.cratedb.com/t/cratedb-cluster-using-docker-doesnt-form/1507/3 "2023-06-06T15:57:10Z")

</div>

Hi hernanc, thank you, your answer solved the situation.

The cluster is formed.

Now I’ve two critical error ,

`The value of the cluster setting 'gateway.expected_data_nodes' (or the deprecated `gateway.recovery\_after\_nodes` setting)must be equal to the maximum/expected number of (data) nodes in the cluster. https://cr8.is/d-node-check-1`

`The value of the cluster setting 'gateway.recover_after_data_nodes' (or the deprecated `gateway.recovery\_after\_nodes` setting)needs to be greater than half of the maximum/expected number of (data) nodes and equal or less than the maximum/expected number of (data) nodes in the cluster. https://cr8.is/d-node-check-2`

Is it correct to set

```auto
gateway.expected_data_nodes = 3
gateway.recover_after_data_nodes = 2

```

with these values ?

Thx.

Luca

---

<div class="post-metadata">

**Author:** ![hernanc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hernanc/32/676_2.png) [@hernanc](https://community.cratedb.com/u/hernanc)\
**Post date:** [June 6, 2023, 4:02pm UTC](https://community.cratedb.com/t/cratedb-cluster-using-docker-doesnt-form/1507/4 "2023-06-06T16:02:16Z")

</div>

Hi,  
Glad that it worked.  
With those settings you mention the warnings should disappear, but there are implications to configure `recover_after_data_nodes` to a value lower than `expected_data_nodes`.  
In 5.4 we are improving the wording around those warnings and the documentation, you can read more about what these mean in the updated documentation which you can reach at this link [System information — CrateDB: Reference](https://crate.io/docs/crate/reference/en/master/admin/system-information.html#recovery-expected-nodes)

---

<div class="post-metadata">

**Author:** ![cocoa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/cocoa/32/783_2.png) [@cocoa](https://community.cratedb.com/u/cocoa)\
**Post date:** [June 6, 2023, 4:51pm UTC](https://community.cratedb.com/t/cratedb-cluster-using-docker-doesnt-form/1507/5 "2023-06-06T16:51:29Z")

</div>

Hi,  
What’s your suggestion for a correct setting of the cluster ?

Thx,  
Luca
