act "services" containers not fully supported running Actions locally
GitHub runs job services as sidecar containers reachable by their service name. act support for services is limited: depending on the version and networking, a step may not resolve the service host, and connections are refused.
What this error means
A step that connects to a service (like postgres:5432) fails with "connection refused" or "could not resolve host" while running under act.
psql: error: could not translate host name "postgres" to address:
Name or service not known
Error: Process completed with exit code 2.Common causes
Service networking is limited under act
act does not fully replicate GitHub service-container networking, so the service hostname may not resolve inside the job.
The service did not become healthy in time
Without GitHub health-check orchestration, the step may run before the service is ready.
How to fix it
Start dependencies yourself for local runs
Run the service with docker and connect over localhost, or use a compose file, instead of relying on job services under act.
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=pw postgres:16
# then connect to localhost:5432 in the stepGate service-dependent steps under act
Skip or adapt steps that need job services when running locally.
- name: Integration tests
if: ${{ !env.ACT }}How to prevent it
- Provision service dependencies manually for local act runs.
- Gate service-dependent steps with
if: !env.ACT. - Validate full service networking on GitHub, not just act.