Skip to main content

Docker Compose Block Producer

Run a Mina block producer node as a separate container, with control over resource allocation, logging, and restarts.

The full Docker Compose configuration — including docker-compose.yml, example environment files for mainnet and devnet, a Makefile, and a README — is maintained in the Mina repository:

mina/src/app/cli/docker-compose/block-producer/

Quick start​

tip

Before running the commands below, review the Configuration section to see all available options — including image tags, network selection, and ports.

git clone https://github.com/MinaProtocol/mina.git
cd mina/src/app/cli/docker-compose/block-producer

# For mainnet
cp example.mainnet.env .env

# For devnet
cp example.devnet.env .env

# Edit .env — set MINA_PRIVKEY_PASS and MINA_LIBP2P_PASS (both required)
vi .env

# Start services
docker compose --env-file .env up -d

# Or use make shortcuts
make mainnet # copies mainnet env and starts services
make devnet # copies devnet env and starts services
note

Every docker compose command on this page passes --env-file .env. Docker Compose reads .env on its own, but other runtimes, such as Podman, do not.

Services overview​

ServiceDescriptionDefault Port
generate_wallet_keyOne-shot: generates the block producer keypair (skipped if one already exists)—
mina_block_producerMina daemon running with --block-producer-key3085 (GraphQL), 8302 (P2P)

Configuration​

All configuration is done through a single .env file. Key variables:

Docker image​

VariableDescription
MINA_DAEMON_IMAGEMina daemon Docker image

The image, for mainnet and devnet, is pulled from Docker Hub (minaprotocol/mina-daemon).

Network​

VariableDescription
MINA_NETWORKmainnet or devnet
MINA_PEERLIST_URLBootstrap peers URL
MINA_PRIVKEY_PASSPassphrase for the block producer key (required)
MINA_LIBP2P_PASSPassphrase for the libp2p key (required)

Ports​

VariableDefaultDescription
MINA_REST_PORT3085GraphQL API port
MINA_P2P_PORT8302P2P networking port (must be reachable from the internet)

Funding the block producer​

After the wallet key is generated, your block producer's public key is stored at ./mina_node/.mina-config/keys/wallet-key.pub on the host. Block production only kicks in once that account holds (or is delegated) staking funds.

cat ./mina_node/.mina-config/keys/wallet-key.pub

Data persistence​

Bind mounts preserve data across docker compose down / up:

Host pathContainer pathContents
./mina_node/.mina-config/root/.mina-configDaemon config, block producer key, libp2p key, peers

Make targets​

CommandDescription
make devnetCopy devnet env and start services
make mainnetCopy mainnet env and start services
make stopStop services
make cleanStop services, remove volumes and .mina-config
make logsFollow logs
make statusShow container status
make healthCheck GraphQL endpoint, sync status, and container summary

Verifying the deployment​

Once services are running and the daemon is connected to peers:

make health

docker compose --env-file .env exec mina_block_producer mina client status

curl -s http://localhost:3085/graphql -H 'Content-Type: application/json' \
-d '{"query":"{ daemonStatus { syncStatus blockchainLength } }"}' | jq .

Clean start​

make clean
docker compose --env-file .env up -d
danger

make clean removes ./mina_node/.mina-config, which contains your block producer key. Back up ./mina_node/.mina-config/keys/ before running it if you want to keep the key.