Docker Compose Snark Workers
This example demonstrates how to run a Mina Snark Coordinator and a Snark Worker using Docker Compose for the Devnet network. The Docker Compose setup includes a Mina Snark Coordinator node, a Snark Worker node, a script to generate a libp2p key, and another script to generate a wallet 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_wallet_key:
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
environment:
MINA_PRIVKEY_PASS: PssW0rD
entrypoint: []
command: >
bash -c '
mina advanced generate-keypair --privkey-path /data/.mina-config/keys/wallet-key
chmod -R 0700 /data/.mina-config/keys
chmod -R 0600 /data/.mina-config/keys/wallet-key
'
volumes:
- './node/mina-config:/data/.mina-config'
mina_snark_coordinator:
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_PRIVKEY_PASS: PssW0rD
MINA_CLIENT_TRUSTLIST: "0.0.0.0/0"
healthcheck:
test: ["CMD-SHELL", "mina client status"]
interval: 60s
timeout: 10s
retries: 100
entrypoint: []
command: >
bash -c '
mina daemon \
--peer-list-url https://bootnodes.minaprotocol.com/networks/mainnet.txt \
--snark-worker-fee 0.001 \
--run-snark-coordinator $(cat /data/.mina-config/keys/wallet-key.pub) \
--work-selection rand
'
# 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_wallet_key:
condition: service_completed_successfully
mina_snark_worker:
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
entrypoint: []
command: >
bash -c '
mina internal \
snark-worker \
--daemon-address \
mina_snark_coordinator:8301 \
--proof-level full
'
volumes:
- './node/mina-config:/data/.mina-config'
depends_on:
mina_snark_coordinator:
condition: service_healthy