问题
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:
Installing version 0.12.4
(I had 0.12.2.2
before) solved the problem. See How can I install the latest wkhtmltopdf on Ubuntu 16.04? for the steps.
来源:https://stackoverflow.com/questions/46399914/how-to-use-wkhtmltopdf-with-docker