If your app is already described in a docker-compose.yml, you can deploy it as it is. A compose service on Hangar runs the whole file, with each of its services, as one unit in your project.
For a single app, a regular service is simpler: it gets builds, rollbacks and preview deployments. Compose is the right fit when the file is the source of truth, for example software that ships with a compose file.
Create a compose service
In a project, choose New → Compose stack and pick how it runs:
| Mode | Runs | Builds | Use it for |
|---|---|---|---|
| Docker Compose | docker compose up on one node | build: and depends_on work, like on your machine | most compose files |
| Swarm stack | docker stack deploy across the region's nodes | images must be prebuilt; build: is ignored | services you want to replicate |
Then set where the file comes from:
- A repository, from a connected Git provider or any public Git URL, with the path to the compose file. Pushes deploy it again, like any other service.
- Raw, by pasting the file into the editor. Good for a quick start or a file that does not live in a repository.
Domains
A compose file can have many services, so a domain names the one it points to. In the compose service's networking settings, add a domain, choose the service in the file and the port it listens on. HTTPS certificates are issued and renewed as for any other domain; see Domains and HTTPS.
You do not need ports: in the file for traffic that comes through a domain.
Variables
Variables set on the compose service are available to the file. Reference them with ${NAME} in the compose file, as you would with a .env next to it. Project and environment variables can be referenced too; see Environment variables.
Logs, metrics and jobs
Logs, metrics and traces are collected for every container of the compose service; see Observability. Cron jobs can run a command in any service of the file.
What you pay for
A compose service is metered like any other: the CPU and memory its containers use, the storage of its volumes and its egress. See Pricing.