A simple but powerful toolset for managing a LaTeX development environment in Docker, consisting of a management script (manage_docker.sh) and a customized Dockerfile.
manage_docker.sh: Bash script to build, run, stop, and manage your LaTeX Docker containerDockerfile: Creates a custom LaTeX environment based ontexlive/texlive:latestwith additional tools
- Docker installed on your system
- Bash-compatible shell
- Proper permissions (either sudo privileges or membership in the
dockergroup)
./manage_docker.sh {build|run|stop|clean-container|clean-image|status|compile}Builds the Docker image named latex-environment.
./manage_docker.sh buildRuns the container, mounting [path] (default: current directory) to /app inside the container.
- Creates a new container if none exists or if the mount path differs
- Optional
detachedparameter runs the container in the background
# Interactive, mount current directory
./manage_docker.sh run
# Interactive, mount specific directory
./manage_docker.sh run /path/to/dir
# Detached mode, mount current directory
./manage_docker.sh run . detachedStops the running container.
./manage_docker.sh stopRemoves the container (stops it first if running).
./manage_docker.sh clean-containerRemoves the image and any dependent containers.
./manage_docker.sh clean-imageChecks the status of both the container and image.
./manage_docker.sh statusCompiles a LaTeX project using make. Requires a Makefile in the directory.
# Compile project in current directory
./manage_docker.sh compile
# Compile project in specific directory
./manage_docker.sh compile /path/to/dir# Build the image
./manage_docker.sh build
# Run the container interactively
./manage_docker.sh run
# Compile a LaTeX project
./manage_docker.sh compile /path/to/latex/project
# Stop the container when finished
./manage_docker.sh stopThe environment includes:
- Base:
texlive/texlive:latest - Utilities:
make,curl,wget,git,jq,perl,pandoc,python3,nodejs,chromium - Fonts: FiraCode variants (Retina, Light, Bold, Regular, SemiBold, Medium)
- Python: Virtual environment with
pandocfiltersandpygments - Node.js:
puppeteer(v25.1.0) and@mermaid-js/mermaid-cli(v11.15.0) - Default Working Directory:
/app - Default Command:
bash - Healthcheck: Verifies
latexmkfunctionality
If you prefer not to use the script for building:
docker build -t latex-environment .- The script uses
set -eand traps to catch errors and provide feedback - If the specified image doesn't exist, you'll be prompted to build it
- Mount paths are checked for consistency; mismatched mounts trigger container recreation
- Container name (
latex-container) and image name (latex-environment) are fixed
- Docker not found: Install Docker or ensure it's in your PATH
- Permission denied: Run with sudo or add your user to the docker group
This project is unlicensed (public domain). Use it as you see fit!