Skip to content
Discussion options

You must be logged in to vote

the service container hostname works on real github actions because they set up a docker network + DNS alias automatically. act doesn't do that by default.

what works for me:

  1. skip the service container and run postgres yourself:
docker run -d --name pg -p 5432:5432 -e POSTGRES_PASSWORD=test postgres:16
act push --env DATABASE_URL=postgresql://postgres:test@host.docker.internal:5432/test

host.docker.internal resolves from inside the job container on docker desktop. on linux you might need --add-host=host.docker.internal:host-gateway.

  1. or if you want to keep the service container in your workflow, pass --network host to act and change your test config to connect to localhost:5432 instead of

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by centranoisacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants