Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

python - Installing Poppler utils of version 0.82 in docker

Below is the dockerfile that I am using

FROM python:3.6-slim
RUN apt update
RUN apt install poppler-utils -y
RUN apt install git -y
WORKDIR /src/
ADD . /src
CMD tail -f /dev/null

when I check the version of poppler using pdftocairo -v , I get 0.71 as the poppler version. I need to install specific version(0.82) of poppler with a python baseimage

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

At the time of writing this answer, the latest version of the Poppler is 20.08.0. If you want to use this version in your Docker image, you can do it as follows:

  1. Create a Dockerfile with the following content

    FROM python:3.8-slim-buster
    RUN apt-get update && apt-get install wget build-essential cmake libfreetype6-dev pkg-config libfontconfig-dev libjpeg-dev libopenjp2-7-dev -y
    RUN wget https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz 
        && tar -xf poppler-data-0.4.9.tar.gz 
        && cd poppler-data-0.4.9 
        && make install 
        && cd .. 
        && wget https://poppler.freedesktop.org/poppler-20.08.0.tar.xz 
        && tar -xf poppler-20.08.0.tar.xz 
        && cd poppler-20.08.0 
        && mkdir build 
        && cd build 
        && cmake .. 
        && make 
        && make install 
        && ldconfig
    CMD tail -f /dev/null
    
  2. Build and run your image

    docker build -t milanhlinak/poppler .
    docker run --name poppler milanhlinak/poppler
    
  3. Verify that Poppler was installed

    PS C:UsersMilanpoppler-docker> docker exec -it poppler pdftotext -v
    pdftotext version 20.08.0
    Copyright 2005-2020 The Poppler Developers - http://poppler.freedesktop.org
    Copyright 1996-2011 Glyph & Cog, LLC
    

You can also check https://hub.docker.com/r/milanhlinak/poppler/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...