22

Docker is a container technology which makes things easier to run as it brings all necessary configuration with it and encapsulates the installation from the rest of the system. It is similar to a virtual machine, but more lightweight.

I think there might be such an container e.g. from arXiv, sharelatex or similar projects.

I imagine to compile scripts like this:

$ sudo docker run docker-latex pdflatex my-pdf-file.tex
Martin Thoma
  • 18,799
  • 1
    I think your problem here is going to be defining a 'full' TeX Live. For almost all cases you can get the system down a lot by starting minimal and adding just what you need. I presume you are targetting some form of automation, which lends itself to doing that work once to keep down storage/bandwidth/... later. – Joseph Wright Sep 13 '17 at 09:11
  • My point being that what you want from an image might be very different from the next person, at which point 'rolling your own' becomes the best plan. – Joseph Wright Sep 13 '17 at 09:14
  • You're right, it is an automation project. With "full" TeX Live, I meant what I get when I follow http://tug.org/texlive/acquire-netinstall.html – Martin Thoma Sep 13 '17 at 13:15
  • 2
    For miktex: https://github.com/MiKTeX/docker-miktex – samcarter_is_at_topanswers.xyz Sep 19 '17 at 10:34
  • You have to run it as root? Does it drop privileges? – cfr Jul 21 '18 at 23:32
  • not official and a shameless plug too: embix/pdflatex try docker run --rm --user $UID:$GID -v $PWD:/sources embix/pdflatex:v1 ./main.tex or docker run -it --rm -v ${PWD}:/sources embix/pdflatex:v1 ./main.tex on windows/powershell if it suits your needs. – mbx Sep 07 '18 at 20:47
  • Not sure how "official" this is, but texlive/texlive provides weekly builds. – Benoit Blanchon Jul 12 '21 at 07:14

1 Answers1

8

Ubuntu bionic is containing tex live. I'm not sure if there's an official one, but you can create your own pretty easily.

Basically it all comes down to:

FROM ubuntu:bionic

RUN ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime \
    && echo "Etc/UTC" > /etc/timezone \
    && apt-get update \
    && apt-get upgrade -y \
    && apt-get install texlive-latex-base texlive-latex-extra texlive-fonts-recommended xzdec -y \
    && rm -rf /var/lib/apt/lists/*

You'll just have to define an entrypoint and also mount the tex folder, which is containing the source files in the container. Command line arguments can be passed to the container as well. I guess you could also simplify it further by wrapping the docker run command in a bash file, which is e.g. mapping the current folder to some predefined mountpoint within the container in order to reduce the amount of parameters during invocation. https://benkiew.wordpress.com/2017/12/03/running-latex-using-a-docker-container/ is listing an example of this approach.

The docker render server might be an alternative approach (https://hub.docker.com/r/vsfexperts/latex-render-server/), if you've only got a single tex file without any external references. You'll just have to interact with the server via http. It's open source, so no strings attached.

  • This would not get you the equivalent of upstream's net install, which is what the OP apparently means by 'full'. Still might be useful for people who don't need everything and don't need everything current, though. – cfr Jul 21 '18 at 23:33
  • 2
    Use apt-get install texlive-full for the "standard" full distribution. Thanks for the timezone trick! – Dmytro Bogatov Aug 07 '19 at 15:06