How to use wkhtmltopdf with Docker

☆樱花仙子☆ 提交于 2019-12-23 12:06:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!