[Tex/LaTex] MiKTeX Linux Docker : LaTeX Error: File `l3backend-xdvipdfmx.def’ not found

linuxmiktex

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

WORKDIR /app
COPY ./ ./

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

EXPOSE 3000
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?

Best Answer

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