I have a Docker container and installed MiKTeX, but when I try to generate a PDF, I get an error:

LaTeX Error: File `l3backend-xdvipdfmx.def' not found.

Here is the Docker file:

FROM node:12.6.0-stretch

COPY fix-proxy-apt /etc/apt/apt.conf.d/99fixbadproxy
RUN apt update && apt install -y apt-transport-https ca-certificates
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D6BC243565B2087BC3F897C9277A7293F59E4889
RUN echo "deb http://miktex.org/download/debian stretch universe" | tee /etc/apt/sources.list.d/miktex.list
RUN apt update && apt install -y git miktex bash
RUN npm config set unsafe-perm

COPY ./ ./

RUN rm -rf ./node_modules
RUN npm install
RUN npm run build

COPY backend.sh /backend.sh
RUN chmod +x /backend.sh

RUN miktexsetup --shared=yes finish
RUN initexmf --admin --set-config-value [MPM]AutoInstall=1

ENTRYPOINT ["/backend.sh"]

From what I understand the following line:

RUN initexmf --admin --set-config-value [MPM]AutoInstall=1

should install missing package, however I still get the error.

I've found this post: File l3backend-pdfmode.def not found when loading expl3

So I tried to add the following line to my dockerfile:

RUN tlmgr update --all

However tlmgr is not found.

Any ideas?

  • 1
    Welcome to TeX.SX! tlmgr is from TeXLive. For MiKTeX see the second answer to the post you linked (tex.stackexchange.com/a/499414/134574). Jul 16, 2019 at 15:30
  • Unfortunately that doesn't really help since the prodcedure is for windows. Jul 16, 2019 at 15:48
  • 1
    the package database is probably outdated (l3backend is quite new) and so miktex doesn't know in which package the missing file is. In windows I would update the database on the command line with mpm --update-db but I have no idea how this is done in your setup. Jul 16, 2019 at 15:55

2 Answers 2


Adding this to the Docker file resolved my issue.

# update file name database
RUN initexmf --update-fndb --admin
# build the font maps
RUN initexmf --mkmaps --admin
# create all possible links
RUN initexmf --mklinks --force --admin
# Check the package repository for updates, then print the list of updateable packages.
RUN mpm --find-updates --admin
# Update all installed packages.
RUN mpm --update --admin
  • I got same error, What is docker file? where can I find it
    – Red shoes
    Jul 27, 2019 at 20:40
  • Dockerfile is a file for docker containers, if you aren't using docker to run miktex you can just use the commands mentionned in the answer w/o the RUN before them. Jul 31, 2019 at 9:31

If you are using MiKTeX, go to MiKTeX ConsoleCheck for updatesInstall.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.