Using Container only on Linux

I have a matrix job that uses both ubuntu-18.04 and macos. But on Linux I don’t want to use the VM directly and would prefer to use a container instead.

Is there a way to specify a container only if the matrix is using ubuntu and not on macos?


Similar topic:

Thanks - marking your reference as solution since this is a duplicated issue.