Skip to the content
Forge

Services

A service is a container that starts next to a run and lives as long as it does: typically a database or a cache the run's tests need. Only the run can reach it, by the service's name.

image: golang:1.24
command: [go, test, ./...]
env:
  DB_DSN: root:${DB_PASS}@tcp(mysql:3306)/test
services:
  mysql:
    image: mysql:8.4
    env:
      MYSQL_ROOT_PASSWORD: ${DB_PASS}
      MYSQL_DATABASE: test
    ready: { port: 3306, timeout_seconds: 180 }
  • A run has up to eight services.
  • The run starts when its services are ready: when a port accepts connections, a command succeeds, or the image's own health check says so.
  • A service that stops or isn't ready in time stops the run, with the service's last output to show why.
  • Each service's output is kept with the run (forge logs --service mysql RUN).