Search code examples
dockerdockerfiletexalpine-linuxtex-live

Docker Alpine Texlive error: tlmgr: not found


I am trying to build a LaTeX Docker image so that I can easily compile LaTeX documents in vim.

But when I run the command docker build -t latex . to build the Docker image with the Dockerfile and texlive-profile.txt files below, I get an error:

/bin/sh: tlmgr: not found

Dockerfile:

FROM alpine:3.9

ENV PATH=/usr/local/texlive/2018/bin/x86_64-linux:$PATH

COPY texlive-profile.txt /tmp/

RUN apk --no-cache add \
      xz \
      wget \
      perl \
      tar \
      fontconfig-dev && \
    wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \
    mkdir /tmp/install-tl && \
    tar -xzf install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
    /tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt && \
    tlmgr update --self && \
    tlmgr install \
      collection-basic \
      collection-fontsrecommended \
      collection-latex \
      collection-latexrecommended \
      collection-latexextra \
      collection-mathscience \
      baskervald \
      biber \
      biblatex \
      cochineal \
      crimson \
      ebgaramond \
      ebgaramond-maths \
      fbb \
      fontawesome \
      genmisc \
      ifetex \
      kpfonts \
      latexmk \
      ly1 \
      ulem && \
    #( tlmgr install xetex || exit 0 ) && \
    apk --no-cache del xz tar fontconfig-dev && \
    rm -rf \
      /var/lib/apt/lists/* \
      /tmp/* \
      /var/tmp/* \
      install-tl-unx.tar.gz

WORKDIR /data

CMD ['/bin/sh']

texlive-profile.txt:

selected_scheme scheme-minimal
TEXDIR /usr/local/texlive
TEXMFCONFIG ~/.texlive/texmf-config
TEXMFHOME ~/texmf
TEXMFLOCAL /usr/local/texlive/texmf-local
TEXMFSYSCONFIG /usr/local/texlive/texmf-config
TEXMFSYSVAR /usr/local/texlive/texmf-var
TEXMFVAR ~/.texlive/texmf-var
option_doc 0
option_src 0

Solution

  • The path should be: ENV PATH=/usr/local/texlive/bin/x86_64-linuxmusl:$PATH