Skip to main content

Running with Docker

info

There is a known issue that you can't use the docker image on the Apple silicon chip. To run Mina Rosetta on Apple silicon, you can use the steps in Building and running Rosetta from source code.

  1. Install Docker and check that your Docker configuration has at least 12 GB RAM (the recommended amount is 16 GB).

  2. Check the latest release for Mainnet on the official Mina GitHub releases page.

  3. Go to minaprotocol/mina-rosetta page on the Docker Hub repository. Pull the image with the commit hash matching to the latest Mainnet release.

  4. Use this image:

note

If you want to build your own docker image, you can find more details in Mina’s Rosetta repository. However, for most users, it’s not necessary to build your own image in order to interact with the API.

The container in /rosetta includes three entrypoints, which each run a different set of services and has different configurations.

  • docker-start.sh (default) - connects the mina node to a network (defaults to Mainnet) and initializes the archive database from publicly-available nightly O(1) Labs backups. This script runs a mina node, mina-archive, a postgresql DB, and mina-rosetta. The script also periodically checks for blocks that may be missing between the nightly backup and the tip of the chain and will fill in those gaps by walking back the linked list of blocks in the canonical chain and importing them one at a time. The script is configurable through environment variables. Take a look at the source for more information about what and how you can configure.
  • docker-standalone-start.sh - starts only the mina-rosetta API endpoint and any flags passed into the script go to mina-rosetta. You may use this for the "offline" part of the Construction API or if you want a setup with each service in its own container.
  • docker-demo-start.sh launches a mina node with a very simple 1-address genesis ledger as a sandbox for developing and playing around in. This script starts the full suite of tools (a mina node, mina-archive, a postgresql DB, and mina-rosetta), but for a demo network with all operations occurring inside this container and no external network activity.

Run the container with following command (replace the image tag with one from dockerhub that's compatible with the network you are trying to connect to, also replace --entrypoint and any environment variable if needed):

docker run -it --rm --name rosetta \
--entrypoint=./docker-start.sh \
-p 8302:8302 -p 3085:3085 -p 3086:3086 -p 3087:3087 \
-e MINA_NETWORK=mainnet \
-e PEER_LIST_URL=https://storage.googleapis.com/seed-lists/mainnet_seeds.txt \
-e MINA_ARCHIVE_DUMP_URL=https://storage.googleapis.com/mina-archive-dumps \
-e MINA_GENESIS_LEDGER_URL=http://673156464838-mina-genesis-ledgers.s3-website-us-west-2.amazonaws.com/mainnet/genesis_ledger.json \
-e BLOCKS_BUCKET=https://storage.googleapis.com/mina_network_block_data \
minaprotocol/mina-rosetta:<tag>

You can also create a file with the environment variables and pass it to the docker run command with --env-file flag. For example, create a file named mainnet.env with the following content:

MINA_NETWORK=mainnet
PEER_LIST_URL=https://storage.googleapis.com/seed-lists/mainnet_seeds.txt
MINA_ARCHIVE_DUMP_URL=https://storage.googleapis.com/mina-archive-dumps
MINA_GENESIS_LEDGER_URL=http://673156464838-mina-genesis-ledgers.s3-website-us-west-2.amazonaws.com/mainnet/genesis_ledger.json
BLOCKS_BUCKET=https://storage.googleapis.com/mina_network_block_data

Then run the container with the following command:

docker run -it --rm --name rosetta \
--entrypoint=./docker-start.sh \
-p 8302:8302 -p 3085:3085 -p 3086:3086 -p 3087:3087 \
--env-file mainnet.env \
minaprotocol/mina-rosetta:<tag>

Example environment files for public networks can be found in this directory of Mina's Rosetta repository.

note
  • It can take 20 min to 1 hour for your node to sync
  • Port 8302 is the default P2P port and must be exposed to the open internet
  • The GraphQL API runs on port 3085 (accessible via localhost:3085/graphql)
  • Archive node runs on port 3086
  • Rosetta runs on port 3087