Help with package installation to use pdftotext

I’m trying to use pdfttotext command on my app.

In my docker I updated the run command to include poppler-utils (which contain the pdftotext command:

RUN apt-get update -y && apt-get install -y build-essential git xpdf poppler-utils\
  && apt-get clean && rm -f /var/lib/apt/lists/*_*

but when I run

IO.inspect(System.cmd("pdftotext", []))

I just get :enoent (get the same even when I give valid file paths)

Can somebody please help ?

Typically a Dockerfile has multiple stages, for example a base stage, a build stage, and a final stage. Look for FROM statements in your Dockerfile.

I’m guessing that you added poppler to a build stage which is is discarded (after all, you typically don’t need compilers installed after the build). What you want to do is to add the installation after the last FROM statement.