Postgres service actions page needs update

Documentation provided postgress service do not work with copy paste & java projects

https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-postgresql-service-containers

It starts working only when I add port postgress port there. Also I got it working only with localhost (instead of service name as hostname)

This is my working build - https://github.com/gintsgints/quarkus-fullstack

I don’t see a bug there: Your job is not running in a container, so it can’t resolve the container name of the service, as described in the Running jobs directly on the runner machine section. Providing DNS resolution for container names between containers only is normal Docker behavior (except on the default bridge network, annoyingly, but Actions doesn’t seem to use that).

If you run the job with the container property and then it can’t resolve the postgres name that’d be a bug. :slightly_smiling_face:

1 Like

But why it did not work with default port?

Looking at your workflow file it seems to work with the default port. The Docker port mapping

        ports:
          - 5432:5432

only makes the Postgres default port available on the host, instead of having to figure out the container IP.