IPFS Cluster provides official dockerized releases at https://hub.docker.com/r/ipfs/ipfs-cluster/ along with a example template for docker-compose.

Below are some information and considerations to be taken into account when running Clusters using Docker.

Docker

If you want to run one of the /ipfs/ipfs-cluster Docker containers, it is important to know that:

The container (Dockerfile here runs an entrypoint.sh script which initializes cluster when no configuration is present. That means it:

Unless you run docker with --net=host, you will need to set $IPFS_API or make sure the configuration has the correct node_multiaddress.

Make sure you read the Configuration documentation for more information on how to configure IPFS Cluster.

You can pass any custom arguments and subcommands for ipfs-cluster-service when running docker run ipfs/ipfs-cluster. By default it runs with daemon --upgrade.

Docker compose

We also provide an example docker-compose.yml which is able to launch an IPFS Cluster with two cluster peers and two ipfs daemons running.

The first cluster peer is launched first and acts as bootstrapper. The second peer is bootstrapped against the first one during the first boot. During the first launch, configurations are automatically generated and will be persisted for next launches in the ./compose folder, along with the ipfs ones.

Only the IPFS swarm port (tcp 4001/4101) and the IPFS Cluster API ports (tcp 9094/9194) are exposed out of the containers.

This compose file is provided as an example on how to set up a multi-peer cluster using Docker containers.