Compile your LaTeX documents faster on Windows with Docker

Photo by Scott Graham on Unsplash

I’m in a university in Japan and writing the doctoral thesis with LaTeX on my Windows laptop computer. It’s a stressful time for me to wait for compilation large files like dissertations to finish.

Recently, I noticed that this stressful situation is unique for Windows system. When I compiled the same document on my Linux desktop computer, the compile process was over in an instant. Of course, the machine power of desktop PC is stronger than laptop one (laptop: Core i7 10510U vs. desktop: Core i7 9700K), but the compile speed was amazingly different.

So, I compared the speed in the same computer, that is, Windows versus WSL. The result is,

Windows: 2 min 40 sec
WSL: 32 sec

5 times faster!!!

I introduce you how to speed up your LaTeX compile on Windows.


  • Windows 10
  • WSL2 (Ubuntu 20.04)
  • Core i7 10510U
  • 16 GB RAM
  • Docker 20.10.10

The directory is like that.

├── Dockerfile
├── docs
│ ├── DoctralThesis.tex
│ ├── .latexmkrc
│ ├── chapters
│ ├── citations.bib
│ ├── mypack.sty
│ ├── report.bst
└── fig
├── ch01
├── ch02
└── ch03

I put my original style file, mypack.sty, in the same directory with my document for the sake of simplicity.

Create Docker container

I created my LaTeX environment with Docker. The Dockerfile is

FROM korosuke613/ubuntu-texlive-ja:latest
WORKDIR /workdir
RUN apt update \
&& apt install -y \
texlive-extra-utils \
make \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*

Build with command

docker build -t latex-dev:1.0.0 .

OK, that’s all. I use latexmk to compile document and re-use the .latexmkrc file in the Windows system.

#!/usr/bin/env perl
$pdf_mode = 3;
$latex = 'platex %O -kanji=utf8 -no-guess-input-enc -interaction=nonstopmode -file-line-error %S';
$bibtex = 'pbibtex %O %B';
$dvipdf = 'dvipdfmx %O -o %D %S';
$makeindex = 'mendex %O -o %D %S';

$biber = 'biber %O --bblencoding=utf8 -u -U --output_safechars %S';
$makeindex = 'mendex %O -o %D %S';

$pvc_view_file_via_temporary = 0;
$pdf_previewer = 'C:/Users/student/AppData/Local/SumatraPDF.exe -reuse-instance'

Let’s compile

Get inside the Docker container.

docker run --rm -it -v ${PWD}:/workdir latex-dev:1.0.0 /bin/bash

I assume “the current directory” is the same with Dockerfile. Move to the document directory in the container and compile with


Congratulations! You got the efficient LaTeX environment in your Windows PC. Enjoy your LaTeX life.




live in Japan

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Mobile Apps Development in Unity Progression Report

CICD Boilerplate for Visual Studio 2019 C++ Solution

If all you do is follow the exact same routine every day, you will never leave yourself

AI Engineers of Melbourne: AI Hackathon

How to Create a Method Using Mongoose

Create own method in mongoose model


Kotlin Co-routines

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


live in Japan

More from Medium

VNC Alternative for working on remote Linux machine

Alexa, ask my TV to do something

An Opinionated Guide to Setting up Git

How to solve the problem that getting a dark image with Raspberry Pi + Motion