Skip to main content

Docker Compose Seed Peer

This example demonstrates how to run a Mina Seed node using Docker Compose for the Mainnet network. This Docker Compose setup includes a Mina seed node, and a script to generate a libp2p key.

Copy and paste the provided configuration into a docker-compose.yml file. Then run docker compose up -d to start the services, and use docker compose logs -f to monitor the logs.

services:
generate_libp2p_key:
image: 'minaprotocol/mina-daemon:3.0.2-4aac388-bullseye-mainnet'
environment:
MINA_LIBP2P_PASS: PssW0rD
entrypoint: []
command: >
bash -c '
mina libp2p generate-keypair -privkey-path /data/.mina-config/keys/libp2p-key
chmod -R 0700 /data/.mina-config/keys
chmod -R 0600 /data/.mina-config/keys/libp2p-key
'
volumes:
- './node/mina-config:/data/.mina-config'
mina_node:
image: 'minaprotocol/mina-daemon:3.0.2-4aac388-bullseye-mainnet'
# image: 'gcr.io/o1labs-192920/mina-daemon:3.0.1-alpha1-0473756-bullseye-devnet' # Use this image for Devnet
restart: always
environment:
MINA_LIBP2P_PASS: PssW0rD
entrypoint: []
command: >
bash -c '
mina daemon \
--peer-list-url https://bootnodes.minaprotocol.com/networks/mainnet.txt \
--libp2p-keypair /data/.mina-config/keys/libp2p-key \
--seed
'
# use --peer-list-url https://bootnodes.minaprotocol.com/networks/devnet.txt for Devnet
volumes:
- './node/mina-config:/data/.mina-config'
ports:
- '8302:8302'
depends_on:
generate_libp2p_key:
condition: service_completed_successfully

To retrieve the status of the Mina Node, run docker compose exec mina_node mina client status

In the client status, you should also see the Adresses and ports section.

Addresses and ports:
External IP: 35.197.32.58
Bind IP: 0.0.0.0
Libp2p PeerID: 12D3KooW9wsoTH3RvWJntT8CnQAMKAYgd1DztxumTaeH3TikQ6b3
Libp2p port: 8302
Client port: 8301

Base on the above output, you can build you "relay circuit" address as follows:

/ip4/35.197.32.58/tcp/8302/p2p/12D3KooW9wsoTH3RvWJntT8CnQAMKAYgd1DztxumTaeH3TikQ6b3

If you prefer using a DNS instead of an IP address, you can use the following format:

/dns4/seed.example.com/tcp/8302/p2p/12D3KooW9wsoTH3RvWJntT8CnQAMKAYgd1DztxumTaeH3TikQ6b3

Finally, you can add the relay circuit address the official Mina Seed Peers list by submitting a pull request to the MinaFoundation/seeds repository