# Multiple IPFS Cluster Nodes in the same machine using Docker

**URL:** <https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095>\
**Category:** Help\
**Tags:** go-ipfs, ipfs-cluster\
**Created:** [October 20, 2018, 6:07pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095 "2018-10-20T18:07:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![plexus](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/plexus/32/1203_2.png) [@plexus](https://discuss.ipfs.tech/u/plexus)\
**Post date:** [October 20, 2018, 6:07pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/1 "2018-10-20T18:07:14Z")

</div>

Is there any updated guide on how to setup what the title describes?  
Since ipfs is not included any more in cluster docker image, i cannot find any detailed resources for the steps needed to achieve this.

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 20, 2018, 11:48pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/2 "2018-10-20T23:48:56Z")

</div>

The process is not different than running a single peer, you just need to run several containers. What is the problem your are facing?

---

<div class="post-metadata">

**Author:** ![plexus](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/plexus/32/1203_2.png) [@plexus](https://discuss.ipfs.tech/u/plexus)\
**Post date:** [October 21, 2018, 11:12am UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/3 "2018-10-21T11:12:57Z")

</div>

@hector first of all i cannot figure out how to setup docker-compose.yml to create go-ipfs nodes.  
What i’d like to do is having something like that:

ipfsnode1 : 192.168.1.101, 4001, 5001, 8080  
ipfsnode2 : 192.168.1.102, 4001, 5001, 8080  
ipfsnode3 : 192.168.1.103, 4001, 5001, 8080

For now i create my nodes creating multiple containers on 127.0.0.1 with different ports, but using docker-compose would be ideal.

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 21, 2018, 11:40am UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/4 "2018-10-21T11:40:32Z")

</div>

hey, have a look here on how that would look like: [Setting up 2 peer IPFS cluster on docker](https://discuss.ipfs.tech/t/setting-up-2-peer-ipfs-cluster-on-docker/3949/3)

Our bad that we haven’t documented a working docker-compose setup yet. I will make it a priority.

---

<div class="post-metadata">

**Author:** ![plexus](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/plexus/32/1203_2.png) [@plexus](https://discuss.ipfs.tech/u/plexus)\
**Post date:** [October 21, 2018, 4:30pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/5 "2018-10-21T16:30:03Z")

</div>

@hector I already tried that.  
I stripped out all cluster stuff and I setup only the ipfs nodes.  
I keep getting an error:  
“ **The network ipfsnodes\_vpcbr cannot be used with services. Only networks scoped to the swarm can be used, such as those created with the overlay driver.** ”

The docker-compose i used:

```
version: '3'

networks:
  vpcbr:
    driver: bridge
    ipam:
     config:
       - subnet: 192.168.1.0/24
         
services:
  ipfs_01:
    image: ipfs/go-ipfs
    ports:
          - "4101:4001"
          - "5101:5001"
          - "8180:8080"
    volumes:
      - ./nodes/ipfs_01/data:/data/ipfs/
      - ./nodes/ipfs_01/staging:/export
    networks:
      vpcbr:
        ipv4_address: 192.168.1.101
    
  ipfs_02:
    image: ipfs/go-ipfs
    ports:
          - "4201:4001"
          - "5201:5001"
          - "8280:8080"
    volumes:
      - ./nodes/ipfs_02/data:/data/ipfs/
      - ./nodes/ipfs_02/staging:/export
    networks:
      vpcbr:
        ipv4_address: 192.168.1.102
```

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 21, 2018, 5:39pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/6 "2018-10-21T17:39:12Z")

</div>

I’m not very fluent in docker compose. but as pointed out in the other thread, you don’t need to provide fixed IP address if docker sets dns names for you.

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 23, 2018, 3:33pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/7 "2018-10-23T15:33:18Z")

</div>

@plexus here you go:

> <https://github.com/ipfs/ipfs-cluster/blob/350eabb915b20680c4e5262da62fc6e98570f9ed/docker-compose.yml>

---

<div class="post-metadata">

**Author:** ![plexus](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/plexus/32/1203_2.png) [@plexus](https://discuss.ipfs.tech/u/plexus)\
**Post date:** [October 25, 2018, 7:18pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/8 "2018-10-25T19:18:14Z")

</div>

Thanks a lot @hector!  
I’m sure under Linux your docker-compose works like a charm.  
But **Docker for Windows** is another poison 😉

The only way to get it running is by **disabling all volumes** , because Docker VMs are having a hard time linking to host’s shares.  
It produces errors no matter what i’ve tried:

> ERROR cmd/ipfs: error from node construction: failure writing to dagstore: sync /data/ipfs/blocks: invalid argument daemon.go:332

(some directories and files are written there though)

If anyone here has encountered and solved this problem the help would be appreciated, because it’s the only way to achieve persistence.

The second issue is a bit easier. How can i modify the compose file to **make the ipfs services run the daemon with --enable-pubsub-experiment**?

Thanks in advance for helping me with my first steps in this great project.

(PS: I also get an error for the container name definitions. It roughly states that **naming a service container is not allowed** )

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 25, 2018, 11:50pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/9 "2018-10-25T23:50:28Z")

</div>

> make the ipfs services run the daemon with --enable-pubsub-experiment?

You’ll need to override the command. Check the Dockerfile and entrypoints from go-ipfs.

> **[Overview](https://docs.docker.com/compose/compose-file/#command)**
>
> Find the latest recommended version of the Docker Compose file format for defining multi-container applications.

---

<div class="post-metadata">

**Author:** ![plexus](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/plexus/32/1203_2.png) [@plexus](https://discuss.ipfs.tech/u/plexus)\
**Post date:** [October 27, 2018, 1:31pm UTC](https://discuss.ipfs.tech/t/multiple-ipfs-cluster-nodes-in-the-same-machine-using-docker/4095/10 "2018-10-27T13:31:57Z")

</div>

OK, i switched to Ubuntu and all glitches vanished, thanks @hector !

Also what is the fastest way to check that pinset coordination works?  
I guess i have to pin a file on a node and then check if it is pinned on the others.  
But how can i get a list of the hashes that are pinned on a node (assuming i have access to that node’s cli)?

EDIT: Solved. With **pin ls** you can get all pinned hashes. Cluster works independedly from ipfs daemon so this command will give different results for each of them.
