# Self-host Consul

> HashiCorp Consul in single-server mode with the web UI: service discovery, health checks and a key-value store.

- Page: https://levelrail.com/templates/consul/
- JSON: https://levelrail.com/templates/consul.json
- Category: Infrastructure
- Licence: BUSL-1.1 (Source available)
- Source: https://github.com/hashicorp/consul
- Upstream docs: https://developer.hashicorp.com/consul/docs

## Requirements
- Memory: about 256 MiB
- amd64: published, arm64: tested
- Needs configuration before start: no
- Pinned image tag: 1.20

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| consul | hashicorp/consul | 1.20 | 8500 | data -> /consul/data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| consul | CONSUL_BIND_INTERFACE | preset |

## Deploy

### CLI

```bash
levelrail-cli templates deploy consul --name my-consul
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/consul/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## Questions

### Can I deploy Consul on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Consul, so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image hashicorp/consul:1.20 is what you deploy there.

Self-host Consul, Consul docker compose file, deploy Consul on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
