# Docker Compose Seed Peer

> Run a Mina Seed node using Docker Compose.

Canonical URL: https://docs.minaprotocol.com/node-operators/seed-peers/docker-compose

Run a Mina seed node — a publicly reachable peer that bootstraps newcomers into the network.

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/seed-peer/`](https://github.com/MinaProtocol/mina/tree/compatible/src/app/cli/docker-compose/seed-peer)**

## Quick start

:::tip
Before running the commands below, review the [Configuration](#configuration) section.
:::

```bash
git clone https://github.com/MinaProtocol/mina.git
cd mina/src/app/cli/docker-compose/seed-peer

# For mainnet
cp example.mainnet.env .env

# For devnet
cp example.devnet.env .env

# Edit .env — set MINA_LIBP2P_PASS (required)
vi .env

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

# Or use make shortcuts
make mainnet
make devnet
```

:::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

| Service | Description | Default Port |
|---------|-------------|--------------|
| **generate_libp2p_key** | One-shot: generates the libp2p keypair | — |
| **mina_seed** | Mina daemon running with `--seed` and `--libp2p-keypair` | 3085 (GraphQL), 8302 (P2P) |

## Configuration

### Docker image

| Variable | Description |
|----------|-------------|
| `MINA_DAEMON_IMAGE` | Mina daemon Docker image |

The image, for mainnet and devnet, is pulled from [Docker Hub](https://hub.docker.com/u/minaprotocol).

### Network

| Variable | Description |
|----------|-------------|
| `MINA_NETWORK` | `mainnet` or `devnet` |
| `MINA_PEERLIST_URL` | Bootstrap peers URL |
| `MINA_LIBP2P_PASS` | Passphrase for the libp2p key (required) |

### Ports

| Variable | Default | Description |
|----------|---------|-------------|
| `MINA_REST_PORT` | `3085` | GraphQL API port |
| `MINA_P2P_PORT` | `8302` | P2P networking port (must be reachable from the internet) |

## Building the relay-circuit address

Once the seed has its libp2p peer ID, build a multiaddr that other nodes can use as a `--peer`:

```bash
make peer-id
```

```
/ip4/<external-ip>/tcp/<libp2p-port>/p2p/<peer-id>
```

or with DNS:

```
/dns4/seed.example.com/tcp/8302/p2p/12D3Koo...
```

You can submit a PR to [`MinaFoundation/seeds`](https://github.com/MinaFoundation/seeds) to be listed in the official seed peer list.

## Data persistence

| Host path | Container path | Contents |
|-----------|---------------|----------|
| `./mina_node/.mina-config` | `/root/.mina-config` | Daemon config, libp2p key, peers |

## Make targets

| Command | Description |
|---------|-------------|
| `make devnet` | Copy devnet env and start services |
| `make mainnet` | Copy mainnet env and start services |
| `make stop` | Stop services |
| `make clean` | Stop services, remove volumes and `.mina-config` |
| `make logs` | Follow logs |
| `make status` | Show container status |
| `make peer-id` | Print this seed's libp2p peer ID |
| `make health` | Check GraphQL endpoint, peer ID, addresses, and container summary |

## Verifying the deployment

```bash
make health

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

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

## Clean start

```bash
make clean
docker compose --env-file .env up -d
```

:::warning
`make clean` removes `./mina_node/.mina-config`, including your **libp2p key**. Your seed's multiaddr will change after a clean restart. Back up `./mina_node/.mina-config/keys/libp2p-key*` if you've published the multiaddr anywhere.
:::
