How to use wkhtmltopdf with Docker

Viewed 18303

When I use wkhtmltopdf (version 0.12.2.4, installed via apt-get) within a Docker container it fails with

QXcbConnection: Could not connect to display

(When I set the environment variable DISPLAY=unix0, I get QXcbConnection: Could not connect to display unix0 which makes sense as no Xserver seems to be installed)

There seems to be a headless version (source) and I thought that would mean that I don't need an Xserver.

(xvfb seems to be another option, but I'm not sure how to run it / what to install)

How can I run wkhtmltopdf in a Docker container, if I can't change the base image to openlabs/docker-wkhtmltopdf?

1 Answers
Related