Does service containers only work with ubuntu-latest?

I have tried to run a postgres db for testing inside GitHub Action.

While exploring the docs, I found this

Well, I was trying to run test across different OS version

    strategy:
      matrix:
        node: [12, 14]
        os: [ubuntu-16.04, ubuntu-18.04]

Will this not work?

Yes, it will work.

This will set up local postgres database for each OS in the matrix.

services:
  postgres:
       image: postgres:11
           env:
             POSTGRES_PORT: 5432
             POSTGRES_DB: db
             POSTGRES_PASSWORD: secret
             # etc..

@mittalyashu ,
Sure, it can work.
I tested with ubuntu-20.04, ubuntu-latest (ubuntu-18.04), and ubuntu-16.04, all of them can run Docker container actions or service containers.
Due to the Ubuntu 20.04 virtual environment is currently provided as a preview only, the ubuntu-latest still uses the Ubuntu 18.04 virtual environment (equal to ubuntu-18.04).

Looks like, the description of the note is causing misunderstanding.
I have created an issue ticket (actions/virtual-environments#1624) to report this question to the appropriate engineering team for further discussion and evaluation.
You can follow the issue ticket and add your comments to it.