Service container's hostname not resolvable

Hello, I am playing around with service containers.
I have this job in my workflow file.

jobs:
  container-job:
    runs-on: ubuntu-latest
    container:
      image: ubuntu
    env:
      DATABASE_NAME: my_database
      DATABASE_USER: foo_user
    services:
      postgres:
        image: postgres
        env:
          POSTGRES_DB: ${{ env.DATABASE_NAME }}
          POSTGRES_USER: ${{ env.DATABASE_USER }}
    steps:
      - name: Install psql client
        run: apt-get -y update && apt-get -y install postgresql-client dnsutils
      - name: Run dns utils
        run: nslookup postgres
      - name: Connect to PostgreSQL
        run: psql -U ${{ env.DATABASE_USER }} -d ${{ env.DATABASE_NAME }} -h postgres -c 'select * from information_schema.tables;'

But the nslookup command returns in an error.

Run nslookup postgres
Server:		127.0.0.11
Address:	127.0.0.11#53
** server can't find postgres: SERVFAIL

The psql step also fails when I remove the nslookup step.

This should be possible based on the documentation. Am I missing something?