Skip to main content

Overview

Docker provides a containerized TeX Live environment, allowing you to compile the CV template without installing LaTeX packages on your system. This approach ensures consistency across different machines and operating systems.

Prerequisites

  • Docker installed on your system
  • Basic familiarity with Docker commands

Docker Image

The template uses the official texlive/texlive:latest Docker image, which includes a full TeX Live distribution.

Basic Usage

From the project root directory, run:
docker run --rm --user $(id -u):$(id -g) -i -w "/doc" -v "$PWD/examples":/doc texlive/texlive:latest pdflatex cv_en.tex

Command Breakdown

FlagPurpose
--rmRemove container after execution
--user $(id -u):$(id -g)Run as current user (preserves file ownership)
-iKeep STDIN open (interactive mode)
-w "/doc"Set working directory inside container
-v "$PWD/examples":/docMount local examples/ to container /doc
texlive/texlive:latestOfficial TeX Live Docker image
pdflatex cv_en.texCommand to execute inside container

Compiling Both Versions

1

Compile English version

docker run --rm --user $(id -u):$(id -g) -i -w "/doc" -v "$PWD/examples":/doc texlive/texlive:latest pdflatex cv_en.tex
2

Compile Indonesian version

docker run --rm --user $(id -u):$(id -g) -i -w "/doc" -v "$PWD/examples":/doc texlive/texlive:latest pdflatex cv_id.tex
3

Verify output

Check that examples/cv_en.pdf and examples/cv_id.pdf were created.

Volume Mounting

The -v flag mounts your local examples/ directory to /doc inside the container:
-v "$PWD/examples":/doc
  • Source: $PWD/examples (your local directory)
  • Target: /doc (container directory)
  • Result: Files compiled in /doc appear in your local examples/ directory
If you mount the wrong directory, the container won’t find your .tex files. Always verify the mount path.

User Permissions

The --user $(id -u):$(id -g) flag runs the container as your current user:
--user $(id -u):$(id -g)
Without this flag, Docker runs as root by default, and generated files will be owned by root, requiring sudo to modify or delete them.
On Windows, you may need to adjust the user flag or omit it entirely, depending on your Docker installation.

Creating a Shell Alias

For convenience, create an alias in your ~/.bashrc or ~/.zshrc:
alias pdflatex-docker='docker run --rm --user $(id -u):$(id -g) -i -w "/doc" -v "$PWD":/doc texlive/texlive:latest pdflatex'
Then compile with:
cd examples
pdflatex-docker cv_en.tex

Docker vs Local Compilation

AspectLocal CompilationDocker
SetupInstall TeX Live (~5-7 GB)Install Docker (~100 MB)
SpeedFast (native)Slower (container overhead)
ConsistencyDepends on installed packagesIdentical across machines
Disk spaceTeX Live on hostImage (~3 GB) + cache
InternetOne-time installPull image once, then offline
UpdatesManual package updatesPull new image version

CI/CD Integration

The GitHub Actions workflow uses a similar approach with the xu-cheng/latex-action@v3 action, which internally uses a TeX Live Docker image:
- name: Compile English CV
  uses: xu-cheng/latex-action@v3
  with:
    working_directory: examples
    root_file: cv_en.tex
This ensures that PDFs compiled locally with Docker match those compiled in CI.

Troubleshooting

Container exits immediately

Verify that the volume mount path is correct:
# Check current directory
pwd

# Verify examples/ exists
ls examples/

Permission denied errors

Ensure you’re using the --user flag:
--user $(id -u):$(id -g)

Image not found

Pull the image manually:
docker pull texlive/texlive:latest

Build docs developers (and LLMs) love