UsageUsing Docker

Running the platform using Docker

Once you have the Docker image on your machine from the previous installation section, you can run it using:

docker run -it --init --rm \
           -p 3000:3000 \
           -v /home/user/my_node.socket:/var/run/node.socket \
              blockfrost-platform --node-socket-path /var/run/node.socket \
                                  --network preview \
                                  --secret my_secret \
                                  --reward-address my_reward_address
💡

Make sure your Cardano node socket is attached as a volume, i.e. -v /home/user/my_node.socket:/var/run/node.socket.

💡

If you don’t specify an IP address (i.e., -p 3000:3000 instead of -p 127.0.0.1:3000:3000) when publishing a container’s ports, Docker publishes the port on all interfaces (address 0.0.0.0) by default. These ports are externally accessible.

Running the entire cluster using Docker compose

The below command will build and run the blockfrost-platform binary, along with the Cardano node, using Docker Compose.

In the root folder of the repository:

# For solitary, run:
NETWORK=preview docker compose -p mainnet --profile solitary up --build -d
 
# To join the Blockfrost cluster, run:
NETWORK=preview SECRET=my-secret REWARD_ADDRESS=my-reward-address docker compose -p mainnet up --build -d
 
# Watch the build
docker compose watch

Please note:

  • If you want to avoid running it in the background, omit the -d flag.
  • If you want to skip building, omit the --build flag.
  • Setting -p mainnet to the desired network will let you run on different networks without messing your node db. You can omit it if you plan to run on the same network always.
  • You don’t need to provide --node-socket-path since it is already handled inside docker-compose.yml.