# Aerospike cluster on docker

**URL:** <https://discuss.aerospike.com/t/aerospike-cluster-on-docker/9682>\
**Category:** Installation\
**Created:** [August 16, 2022, 10:52am UTC](https://discuss.aerospike.com/t/aerospike-cluster-on-docker/9682 "2022-08-16T10:52:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ghanshyam](https://avatars.discourse-cdn.com/v4/letter/g/ba8739/32.png) [@Ghanshyam](https://discuss.aerospike.com/u/Ghanshyam)\
**Post date:** [August 16, 2022, 10:52am UTC](https://discuss.aerospike.com/t/aerospike-cluster-on-docker/9682/1 "2022-08-16T10:52:32Z")

</div>

Following the below link for docker aerospike cluster installation. [How do I get a 2 nodes Aerospike cluster running quickly in Docker without editing a single&nbsp;file? - DEV Community 👩‍💻👨‍💻](https://dev.to/aerospike/how-do-i-get-a-2-nodes-aerospike-cluster-running-quickly-in-docker-without-editing-a-single-file-2bnj) Have watched a few youtube videos from aerospike official channel, and they have also recommended the above link.

While adding node into cluster: "docker exec -ti aerospike1 asinfo -v ‘tip:host=;port=3002’ " Getting below error, have tried to exposed 3002 port via TCP & udp both portocol.

Aug 16 2022 10:25:38 GMT: WARNING (hb): (hb.c:4906) (repeated:10) could not create heartbeat connection to node - 172.17.0.3 {172.17.0.3:3002} Aug 16 2022 10:25:38 GMT: WARNING (socket): (socket.c:871) (repeated:10) Error while connecting: 111 (Connection refused) Aug 16 2022 10:25:38 GMT: WARNING (socket): (socket.c:930) (repeated:10) Error while connecting socket to 172.17.0.3:3002

Any luck around the same?

---

<div class="post-metadata">

**Author:** ![aanderson](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/aanderson/32/2064_2.png) [@aanderson](https://discuss.aerospike.com/u/aanderson)\
**Post date:** [August 19, 2022, 12:54am UTC](https://discuss.aerospike.com/t/aerospike-cluster-on-docker/9682/2 "2022-08-19T00:54:45Z")

</div>

Hi @Ghanshyam, I was pointed to [this repo](https://github.com/thecloudslayer/aerospike-docker-compose) that has a nice Docker Compose setup for a two node cluster with Aerospike Community Edition. I imagine it would be fairly easy to breakdown and see how it works. Hopefully this helps!

---

<div class="post-metadata">

**Author:** ![Ghanshyam](https://avatars.discourse-cdn.com/v4/letter/g/ba8739/32.png) [@Ghanshyam](https://discuss.aerospike.com/u/Ghanshyam)\
**Post date:** [August 19, 2022, 7:03am UTC](https://discuss.aerospike.com/t/aerospike-cluster-on-docker/9682/3 "2022-08-19T07:03:09Z")

</div>

Thanks, @aanderson , we will try these.

---

<div class="post-metadata">

**Author:** ![lucien](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/lucien/32/2065_2.png) [@lucien](https://discuss.aerospike.com/u/lucien)\
**Post date:** [August 19, 2022, 3:49pm UTC](https://discuss.aerospike.com/t/aerospike-cluster-on-docker/9682/4 "2022-08-19T15:49:10Z")

</div>

Looks like a change in default aerospike.conf is at play here:

The address is binding to “local” instead of “eth0” the container’s interface:

```auto
	heartbeat {
		# mesh is used for environments that do not support multicast
		mode mesh
		address local
		port 3002
		interval 150
		timeout 10
	}

	fabric {
		# Intra-cluster communication port (migrates, replication, etc)
		# default to same address in 'service'
		address local
		port 3001
	}

```

You can solve it by providing your own aerospike.conf in the docker run command line as described here:

> **[GitHub - aerospike/aerospike-server.docker: Dockerfile for Aerospike Server...](https://github.com/aerospike/aerospike-server.docker#advanced-configuration-)**
>
> Dockerfile for Aerospike Server Community Edition. Contribute to aerospike/aerospike-server.docker development by creating an account on GitHub.

If you don’t have an aerospike.conf file, you can use the one from the running containers that you created and replace address local with address eth0.

```auto
mkdir aero1
mkdir aero2

docker cp aerospike1:/etc/aerospike/aerospike.conf aero1/
docker cp aerospike2:/etc/aerospike/aerospike.conf aero2/

sed -i'' -e 's/local/eth0/g' aero1/aerospike.conf 
sed -i'' -e 's/local/eth0/g' aero2/aerospike.conf 

docker stop aerospike1
docker stop aerospike2

docker rm aerospike1
docker rm aerospike2

docker run -tid -v $(pwd)/aero1:/etc/aerospike/ --name aerospike1 -p 3000:3000 -p 3001:3001 -p 3002:3002 -p 3003:3003 aerospike/aerospike-server

docker run -tid -v $(pwd)/aero2:/etc/aerospike/ --name aerospike2 -p 6000:3000 -p 6001:3001 -p 6002:3002 -p 6003:3003 aerospike/aerospike-server

```

Then you should be able to form a cluster.
