Docker Community Forums

Share and learn in the Docker community.

I got this error : QXcbConnection: Could not connect to display :109 Aborted

I’m trying to perform HTML to PDF conversion with class library in Linux docker 3.1 using multithreading. The HTML converter has some dependency packages to be installed in the environment where the conversion takes place.

So, I tried to install the packages using dockerfile in Linux. But I am getting errors when trying to run the conversion in multithreading. Below are the commands, which I have used in my dockerfile.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
RUN apt-get update && apt-get -y install xvfb && apt-get -y install fontconfig && apt-get -y install libx11-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-shm0-dev libxcb-util0-dev libxcb-xfixes0-dev libxcb-xkb-dev libxcb1-dev libxfixes-dev libxrandr-dev libxrender-dev

WORKDIR /app
EXPOSE 80
EXPOSE 443
CMD [“sh”, “/app/product.sh”]

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Below is the exception message which i am getting from docker sample in multi threading.

No protocol specified
QXcbConnection: Could not connect to display :110
Aborted

I have tried using this below shell commands (product.sh) to resolve this exception,

#!/bin/bash
export DISPLAY=:0
xhost +local:docker

But still Im getting an same exception, Can someone help me to solve this exception in Linux docker using multithreading in VS2019.

Thanks in Advance,
Gowtham

It is really bad that you receive this exception. However, it is not wkhtmltopdf package support, so I am pretty sure that we can’t help you, because it is nothing related to snappy package. Moreover, you haven’t commented out the way you have installed wkhtmltopdf.
Please, check out that you have installed libx11-6, libxext6 and libxrender1 (and all other required by the package deps).
And I encourage you to comment on the existing issue in wkhtmltopdf/wkhtmltopdf repo next time if it is not related to SnappyBundle. It will also help the maintainers of this piece of software and users of it.