Skip to main content

Docker Compose SNARK Workers

This example runs a SNARK coordinator and a SNARK worker together using Docker Compose. It includes a one-time init container that generates a wallet key.

Save the following as docker-compose.yml, then start with docker compose up -d. Monitor logs with docker compose logs -f.

services:
generate_wallet_key:
image: 'minaprotocol/mina-daemon:3.3.0-8c0c2e6-bullseye-mainnet'
environment:
MINA_PRIVKEY_PASS: PssW0rD
entrypoint: []
command: >
bash -c '
mina advanced generate-keypair --privkey-path /root/.mina-config/keys/wallet-key
chmod -R 0700 /root/.mina-config/keys
chmod -R 0600 /root/.mina-config/keys/wallet-key
'
volumes:
- './node/mina-config:/root/.mina-config'
mina_snark_coordinator:
image: 'minaprotocol/mina-daemon:3.3.0-8c0c2e6-bullseye-mainnet'
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 /root/.mina-config/keys/wallet-key.pub) \
--work-selection rand
'
volumes:
- './node/mina-config:/root/.mina-config'
ports:
- '8302:8302'
depends_on:
generate_wallet_key:
condition: service_completed_successfully
mina_snark_worker:
image: 'minaprotocol/mina-daemon:3.3.0-8c0c2e6-bullseye-mainnet'
restart: always
entrypoint: []
command: >
bash -c '
mina internal \
snark-worker \
--daemon-address \
mina_snark_coordinator:8301 \
--proof-level full
'
volumes:
- './node/mina-config:/root/.mina-config'
depends_on:
mina_snark_coordinator:
condition: service_healthy

To scale additional workers, duplicate the mina_snark_worker service with a different name (e.g. mina_snark_worker_2).