# Deploying ENSNode with Docker

The Docker images are the easiest way to run or deploy the ENSNode suite of services, both locally and in the cloud.

:::note[Postgres Requirement]
ENSIndexer runs `CREATE EXTENSION IF NOT EXISTS pg_trgm` at startup to back partial-name search indexes. If you're swapping out the bundled `postgres:17` image for a managed or custom Postgres, make sure the [`pg_trgm`](https://www.postgresql.org/docs/current/pgtrgm.html) extension is available for installation (it ships with stock Postgres contrib and is available for installation on most managed providers).
:::

[Configure Environment Variables](/docs/services/ensindexer/usage/configuration)

ENSNode provides several [Docker Compose](https://docs.docker.com/compose/) files for different use cases:

- **`docker/docker-compose.yml`** — base stack for mainnet/sepolia: ensindexer, ensapi, ensrainbow, ensadmin, ensdb (postgres)
- **`docker/docker-compose.devnet.yml`** — full stack against local devnet (ens-test-env), works out of the box with no configuration required

### Mainnet / Sepolia

Copy the example env file and configure it:

```bash
cp docker/envs/.env.docker.example docker/envs/.env.docker.local
```

Edit `docker/envs/.env.docker.local` to set your `NAMESPACE`, `PLUGINS`, and RPC endpoints (e.g. `ALCHEMY_API_KEY` or `RPC_URL_1`), then run:

```bash
docker compose -f docker/docker-compose.yml up -d
```

### Local devnet

Configuration is optional. To customize defaults (e.g. change `PLUGINS`), copy the example as in previous step and edit it.

Otherwise, skip setup and run directly:

```bash
docker compose -f docker/docker-compose.devnet.yml up -d
```

[Docker Compose usage and commands](https://github.com/namehash/ensnode/blob/main/docker/README.md)

[View Docker Compose files on GitHub](https://github.com/namehash/ensnode/blob/main/docker)

[Building ENSNode Docker Images](/docs/reference/contributing/building)

:::note[Port Mappings]
Note that while the default `docker/docker-compose.yml` exposes each container's port to the host machine (useful for development), you may only wish to expose ENSApi's `4334` and avoid exposing services like ENSRainbow, ENSAdmin, and Postgres to the wider internet.
:::