Run a Dagger service (e.g., a database container) as a sidecar bound to a test container using Dagger Services, ensuring the service is health-checked before tests start
Define the database container using the Dagger client and call AsService() to convert it into a Dagger Service object
On the test container, call WithServiceBinding(alias, service) to inject the service and make it reachable at the given hostname alias from within the test container
Optionally call the service's WithHealthcheck method with an appropriate command so the engine waits for the service to be ready before executing dependent steps
Run the test step (e.g., container.WithExec(['go', 'test', './...'])) which will automatically start the service sidecar in the correct order
Retrieve stdout or exit code with Stdout() or Sync() and confirm the tests connected to the service successfully
Known gotchas
Dagger services are started lazily when first referenced; if the health check is omitted, tests may start before the service is ready, causing flaky failures
Service hostnames are only resolvable within the network of containers that have a WithServiceBinding for that service; other containers in the pipeline cannot reach them
Stopping a service explicitly is generally unnecessary as the engine manages service lifetime to the scope of the session, but long-running pipelines may need explicit termination to reclaim ports
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp