How to use headless Chrome in Docker?

Currently I’m using MPDF to convert complicated html files to pdf with PHP Laravel (production server is Ubuntu 22.04 and development is Docker image with Ubuntu 22.04). I would like to improve the conversion quality and try to use conversion based on Google Chrome features.

Added chromium-browser install into dockerfile: apt-get install -y chromium-browser

And trying to run this code:

$browser = (new BrowserFactory('chromium-browser'))->createBrowser(['windowSize' => [1920, 1080]]);

$page = $browser->createPage();
$page->setHtml($html);

return base64_decode(
  $page->pdf([
    'printBackground' => true
  ])->getBase64()
);

Getting error: Chrome process stopped before startup completed. Additional info: Command ‘/usr/bin/chromium-browser’ requires the chromium snap to be installed. Please install it with: snap install chromium

When I try to execute command snap install chromium getting error error: cannot communicate with server: Post “http://localhost/v2/snaps/chromium”: dial unix /run/snapd.socket: connect: no such file or directory

How can I use headless Chrome with Ubuntu in docker and without docker (in production)?
Thank you!