Home

Awesome

TeXlive Docker Images

Yet another attempt at coming up with working and generally applicable Docker images for TeXlive.

The basic concept is to provide small-ish base images which install additional packages from CTAN if and when needed.

These images attempt to cover the following use cases:

We currently publish the following images based on different selections from the TeXlive collections suggested by the installer; from smaller to larger:

We also provide PoCs to demonstrate that more involved applications can be built on top of the base images provided here:

<!-- TODO - devcontainers --> <!-- TODO - LaTeX CI pipeline: https://github.com/reitzig/dh-tools --> <!-- TODO - LaTeX build server. --> <!-- TODO - Document generation server. -->

Usage

The fastest way to build a document at hand (once) is this:

docker run --rm \
    --volume `pwd`:/work/src:ro \
    --volume `pwd`/out:/work/out \
    reitzig/texlive-base-luatex \
    work lualatex hello_world.tex

Note:

See the scripts in examples for other ways to use the images.

Dependencies

Place a file called Texlivefile with a list of required CTAN packages, one name per line, in the source directory. The container will install all packages on that list before running the work command.


⚠️ Installing dependencies in this way will stop working once a new version of TeXlive is released, with an error like this:

tlmgr: Local TeX Live (2023) is older than remote repository (2024).

If you need to keep using an older image for a little while, you can override the repository by setting environment variable TEXLIVE_REPOSITORY to a value like

https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2023/tlnet-final

This feature has been available since 2024.2; see reitzig/texlive-docker#18.2022953222 for hints on how to backport it to older images.

⚠️ Note that most CTAN mirrors do not maintain historic versions (cf. tex.SE#460132), so keep in mind that widespread use of this workaround will stress those few mirrors that do. We strongly recommend upgrading to the latest TeXlive version as soon as possible!

<!-- TODO: provide example-->

ℹ️ That said, an alternative is to maintain custom Docker images with historic package versions<!--; see [here](TODO) for an example-->. This approach completely avoids the need for running tlmgr at runtime, so repository freeze does not impact your builds.


Parameters

You can adjust some defaults of the main container script by setting environment variables

Debugging

All output of the work command is collected in a single folder; extract it with:

docker cp $container:/work/tmp ./

Build

Run

docker build -t texlive-base-luatex --build-arg "profile=base-luatex" .

to build an image locally. Exchange base-luatex for any of the profile names in profiles to start from another baseline.

Customization

If you repeatedly need the same exact set of dependencies or even sources, it might make sense to create your own TeXlive Docker image. There are two ways to go about that:

<!-- Note: Repo-relative links will be rewritten by update-dockerhub-info.sh before pushing to Docker Hub -->