Chromedriver/chromium, headless in a Docker container, what am I missing?

I’m using Nix/Nixpkgs to put together a Docker image for running chromedriver/chromium in headless mode.

I’m currently using the following list of packages to populate my image:

    contents = [chromedriver
                chromium
                gnugrep
                bash
                coreutils
               ];

I can verify that chromedriver starts, but when I try to start a session I get the following fatal error:

[0111/144547.249167:FATAL:platform_font_skia.cc(97)] Check failed: InitDefaultFont(). Could not find the default font

If I add xvfb_run to the list of packages this error goes away. Since I run in headless mode I don’t really need X and thus I’d like to not include xvfb_run, but what package do I need to add, what is it that chromium needs?

1 Like

For anyone who encounters this error in the future, I found the answer in the IRC logs. Add this to your build environment:

FONTCONFIG_FILE = pkgs.makeFontsConf { fontDirectories = [ ]; };
1 Like