Skip to content
Latchkey

How to Choose Compose vs GitHub Actions Services

The services block is simplest for one or two backends, while Compose wins when you want the same multi-service stack locally and in CI.

Use the Actions services: block for a lone database. Reach for Compose when you have several interdependent services, custom build contexts, or want CI to match docker compose up on a laptop.

Comparison

Factorservices blockdocker compose
Multi-service stacksVerboseNative
Local parityNoneSame file locally
Custom build contextNoYes via build:
Startup orderingManualdepends_on + healthy

Compose approach

.github/workflows/ci.yml
steps:
  - uses: actions/checkout@v4
  - run: docker compose up -d --wait
  - run: npm test

Gotchas

  • With the services block the job reaches the DB on localhost; with Compose the runner reaches it on the mapped host port.
  • If your team already runs docker compose up locally, using Compose in CI removes a whole class of "works on my machine" gaps.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →