I'm developing a Docker container with a Debian 10 base image (this is a fixed dependency) that converts docx files to pdf using LibreOffice (soffice) in headless mode.

I've got it working with the following packages installed:

libreoffice default-jre-headless libreoffice-java-common

However, when built, the Docker container size is over 1GB. Ideally, I'd like the container to be as small as possible. Is there a way I can find out what are the minimum package requirements to get soffice to run in headless mode and convert the docx files to pdfs?

  • 2
    libreoffice is a metapackage that requires or suggests several packages. Maybe you can install a subset of the dependencies. If you only want to process text documents you could omit packages related to spreadsheets and other document types, like libreoffice-calc, libreoffice-impress etc. I don't know if you can omit parts of the Java libraries.
    – Bodo
    Apr 29, 2022 at 8:59
  • 1
    Even with careful selection of libreoffice-* packages, it's probably still going to pull in a lot of fonts, X, and possibly desktop environment packages. And a bunch of other stuff. Libreoffice is a GUI app, even at bare minimum it requires a lot of "infrastructure". Maybe look into pandoc instead of LO if docker image size is crucial.
    – cas
    Apr 29, 2022 at 11:37

1 Answer 1


There seems to be no official support for this. I had the same problem with Docker/Kubernetes and solved it succesfully with following approach. LibreOffice v7.5 in this case.

  • download the deb-Package from https://de.libreoffice.org/download/download
  • extract it, you get about 40-50 deb-files
  • I did a trial&error approach and found following set of deb-files to be neccessary for converting DOCX to PDF at serverside:
  • put these debs in a separate directory and install via: dpkg -i *.deb

  • Test direct conversion:

    /opt/libreoffice7.5/program/soffice --headless --convert-to pdf ./demo.docx --outdir ./

  • Run daemon:

    /opt/libreoffice7.5/program/soffice --headless --accept=socket,host=",port=8100\;urp;" &

  • for a more automated way I repacked the above list of deb-files, deployed and installed them via the DOCKERFILE

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .