How Docker works on MacOS?

I am curios about containers and Docker on MacOS.

Although Docker is working with linux cgroups, as far as i know MacOS darwin kernel does not support cgroups. So how can Docker works on MacOS?

Is there another darwin-specific implementation on docker?

Thanks in advance.

Source: StackOverflow