1

I am trying to create a Docker image with texlive which is not >4G heavy like docker.io/texlive/texlive. Installing e.g. from Debian sources won't build, because once you want to add certain packages (e.g. tlmgr install cleveref) right now it only says:

tlmgr: Local TeX Live (2020) is older than remote repository (2021).

because CTAN mirrors have updated to 2021, but Debian has not.

So I am trying to install the recommended way using install-tl-unx.tar.gz, but this also keeps failing because no CTAN mirror can be reached. Here is a minimum example of the Dockerfile:

FROM alpine:latest
RUN apk add perl
RUN wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz; \
    tar -xzf install-tl-unx.tar.gz;
RUN cd install-tl-* ; \
    perl ./install-tl 

It fails stating that it cannot contact mirror.ctan.org, even though a second before it downloaded the installer from the very same site:

query_ctan_mirror: Programs not set up, trying wget
Loading http://www.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb
cannot contact mirror.ctan.org, returning a backbone server!

./install-tl: TLPDB::from_file could not initialize from: http://www.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb
./install-tl: Maybe the repository setting should be changed.
./install-tl: More info: https://tug.org/texlive/acquire.html

We can even force using that server and also force HTTPS with the --location argument:

RUN cd install-tl-*; \
    perl ./install-tl --location https://mirror.ctan.org/systems/texlive/tlnet

Still the same, the server cannot be reached. I also tried other mirrors, which I tested to be available in my browser, none worked.

So I wonder what I need to do to have that installation run reliably, so that this can run inside a CI job.

18
  • Perhaps not directly important, but why are you doing perl ./install.sh rather than just source ./install.sh?
    – Joseph Wright
    Apr 29, 2021 at 15:08
  • 1
    Other than the above comment, what you are doing looks very similar to e.g. github.com/latex3/latex3/blob/main/support/texlive.sh
    – Joseph Wright
    Apr 29, 2021 at 15:09
  • It says to use perl in the docs
    – mcnesium
    Apr 29, 2021 at 15:09
  • That latex3 script is doing the same as mine. Downloading the installer works fine, but then the actual loading of texlive.tlpdb fails, see pastebin.com/a3viMFUX
    – mcnesium
    Apr 29, 2021 at 15:22
  • 1
    @mcnesium I understand the problem with tlmgr, the solution I proposed is to not use tlmgr for anything, but instead install a few small texlive-xyz packages from Debian, which would leave you with a 2020 TeX Live but that is fine for most purposes and is much less than 4GB - and most importantly it is very easy to install in Docker. In this scenario, if you want an extra package, you locate the appropriate Debian package that contains that LaTeX package, and you install that with apt or similar.
    – Marijn
    Apr 30, 2021 at 15:12

1 Answer 1

0

For those who search for a way to install texlive from CTAN in a Docker container based on Alpine, check out this repository kjarosh/latex-docker.

The repo contains a Dockerfile that installs texlive in one of the desired schemes - minimal (~40MB), basic (~90MB), small (~180MB), medium (~500MB), full (~2GB). Already with basic scheme I was able to use pdflatex command to compile .tex source into a .pdf file.

To install additional packages use tlmgr install <packagename> or even install a list of packages from a text file by running tlmgr install `cat texpackages.txt`. Note the backquotes are important otherwise the command won't work.

You must log in to answer this question.

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