Docker with wkhtmltopdf is not work correctly

1.3k Views Asked by At

I am trying to use wkhtmltopdf in a container with Docker and Symfony. The installation is done well, but the result is very different from the reality, so I think some libraries must be missing in the system, but I don't know which one.

I've been checking other questions here and in google, but they don't help.

    FROM phpdockerio/php71-fpm:latest

    # Fix debconf warnings upon build
    ARG DEBIAN_FRONTEND=noninteractive

    # Install selected extensions and other stuff
    RUN apt-get update \
        && apt-get -y --no-install-recommends install  cron \
        php7.1-mysql \
        php-redis \
        php7.1-bcmath \ 
        php7.1-gd \
        php-imagick \
        php7.1-intl  \
        cron \
        python \
        xz-utils \
        libxrender1 \
        libfontconfig1 \
        zlib1g \ 
        fontconfig \ 
        libfreetype6 \ 
        libx11-6 \ 
        libxext6 \
        wkhtmltopdf

    RUN curl --insecure https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer


    RUN cd /tmp \
        && curl "https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz" -L -o "wkhtmltopdf.tar.xz" \
        && tar Jxvf wkhtmltopdf.tar.xz \
        && rm wkhtmltopdf.tar.xz \
        && mv wkhtmltox/include/* /usr/local/include/ \
        && mv wkhtmltox/lib/* /usr/local/lib/ \
        && mv wkhtmltox/bin/* /usr/local/bin/ \
        && mv wkhtmltox/share/* /usr/local/share/
RUN apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

CMD php-fpm -F

This is the result in the container(docker) enter image description here

And this is the result on my machine (without docker), as it should be.

enter image description here

Any idea what might be happening?

0

There are 0 best solutions below