
raabf/texstudio-versionsDockerTeX 和 DockerTeXstudio 是一系列提供完整 LaTeX 环境的 Docker 镜像,支持多种 TeX Live 版本和 TeXstudio GUI。这些镜像基于 Debian 和 Ubuntu 构建,旨在为 LaTeX 文档开发提供一致、隔离且功能完备的环境,适用于从命令行编译到 GUI 编辑的各种使用场景。
| 镜像名称 | 架构 | 描述 |
|---|---|---|
| raabf/latex-versions | x86_64 | 命令行 LaTeX 环境 |
| raabf/latex-versions-arm | ARM | ARM 架构的命令行 LaTeX 环境 |
| raabf/texstudio-versions | x86_64 | 包含 TeXstudio GUI 的 LaTeX 环境 |
当 Debian 或 Ubuntu 基础镜像更新时(平均每月一次),所有镜像都会在 Dockerhub 上自动重建。
可通过 TeX Live 版本标签(如 texlive2016)或发行版代号(如 stretch)指定所需版本:
| TeX Live 版本 | Docker 标签 | 基础发行版 | 备注 |
|---|---|---|---|
| v2012 | texlive2012 | Debian wheezy | EOL,最后支持的 TeXstudio: 2.12.10-2 |
| v2013 | texlive2013 | Ubuntu trusty | EOL,最后支持的 TeXstudio: 2.12.14-1 |
| v2014 | texlive2014 | Debian jessie | EOL,最后支持的 TeXstudio: 2.12.14-1 |
| v2015 | texlive2015 | Ubuntu xenial | EOL,最后支持的 TeXstudio: 2.12.22-1 |
| v2016 | texlive2016 | Debian stretch | ARM 架构最新标签 |
| v2017 | texlive2017 | Ubuntu bionic | - |
| v2018 | texlive2018 | Debian buster | - |
| v2019 | texlive2019 | Ubuntu focal | - |
| v2020 | texlive2020 | Debian bullseye | - |
| v2021 | texlive2021 | Ubuntu jammy | 最新稳定版 (latest 标签) |
| v2022 | texlive2022 | Debian bookworm | 测试版 (testing 标签),开发中 |
注:EOL 表示该发行版已终止支持,不再接收更新,但镜像仍可正常使用。
bashdockertex [-t|--tag tagname] command
编译当前目录中的 document.tex:
bash# 使用默认标签(texlive2021) dockertex pdftex document.tex # 指定特定版本 dockertex --tag texlive2018 pdflatex document.tex # 使用 Makefile dockertex --tag texlive2019 make all
设置默认标签,避免每次输入 --tag:
bashexport DOCKERTEX_DEFAULT_TAG="texlive2018"
指定容器引擎(默认为 podman,如果已安装,否则为 docker):
bashexport DOCKERTEX_ENGINE="docker"
bashdockertexstudio [-t|--tag tagname] [-v|--volume mapping]* [texstudio options]
启动默认版本的 TeXstudio:
bashdockertexstudio
指定标签和额外卷挂载:
bashdockertexstudio --tag texlive2019 --volume /media/data/tex:/home/user/tex
直接打开特定文件:
bashdockertexstudio --tag texlive2021 document.tex
bashx11docker --network=host --share $HOME raabf/texstudio-versions:texlive2021
设置默认标签:
bashexport DOCKERTEXSTUDIO_DEFAULT_TAG="texlive2020"
指定容器引擎:
bashexport DOCKERTEXSTUDIO_ENGINE="podman"
直接使用 docker 命令运行特定版本的 LaTeX:
bash# 编译单个文件 docker run --rm -v "$PWD":/workdir -u "$(id -u):$(id -g)" raabf/latex-versions:texlive2021 pdflatex document.tex # 启动交互式 bash docker run -it --rm -v "$PWD":/workdir -u "$(id -u):$(id -g)" raabf/latex-versions:texlive2021 bash
运行 TeXstudio GUI:
bashdocker run --rm \ -v "$HOME":/home/user \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e DISPLAY \ -u "$(id -u):$(id -g)" \ --network=host \ raabf/texstudio-versions:texlive2021
创建 docker-compose.yml 文件:
yamlversion: '3' services: latex: image: raabf/latex-versions:texlive2021 volumes: - ./:/workdir user: "${UID}:${GID}" command: pdflatex document.tex texstudio: image: raabf/texstudio-versions:texlive2021 volumes: - "${HOME}:/home/user" - "/tmp/.X11-unix:/tmp/.X11-unix" environment: - DISPLAY user: "${UID}:${GID}" network_mode: "host" command: texstudio
使用方法:
bash# 编译文档 UID=$(id -u) GID=$(id -g) docker-compose run latex # 启动 Texstudio UID=$(id -u) GID=$(id -g) docker-compose run texstudio
推荐使用 zsh 插件管理器安装命令行工具,便于自动更新。
在 ~/.zshrc 中添加:
zshzplug raabf/dockertex, \ from:gitlab, \ hook-build:"./posthook.sh --menu-tag latest --menu-volume /media/ext/=/home/ext/"
安装多个版本的菜单条目:
zshzplug raabf/dockertex, \ from:gitlab, \ hook-build:"./posthook.sh --menu-tag latest; ./posthook.sh --menu-tag texlive2018"
适用于非 zsh 用户:
bash# 基本安装(当前用户) curl [***] | bash -s -- --menu-tag latest # 系统级安装 curl [***] | bash -s -- --system --menu-tag latest # 安装并添加额外卷挂载 curl [***] | bash -s -- --menu-tag latest --menu-volume "/media/data/tex:/home/user/tex" # 仅安装命令行工具,不安装 Texstudio curl [***] | bash -s -- --no-texstudio
查看帮助信息:
bashcurl [***] | bash -s -- --help
bashsudo cp bin/dockertex.sh /usr/local/bin/dockertex sudo cp bin/dockertexstudio.sh /usr/local/bin/dockertexstudio sudo chmod a+x /usr/local/bin/dockertex*
bashsudo cp misc/icons/hicolor/scalable/apps/texstudio.svg /usr/local/share/icons/hicolor/scalable/apps/
bashsudo cp misc/dockertexstudio.desktop /usr/local/share/applications/dockertexstudio.desktop sudo tee -a /usr/local/share/applications/dockertexstudio.desktop << EOF Name=Docker TexStudio (latest) Exec=/usr/local/bin/dockertexstudio --tag latest %F Icon=/usr/local/share/icons/hicolor/scalable/apps/texstudio.svg EOF
创建 .gitlab-ci.yml 文件:
yamlstages: - build build_latest: image: raabf/latex-versions:latest stage: build script: - pdflatex -interaction=nonstopmode document.tex - biber document - pdflatex -interaction=nonstopmode document.tex artifacts: paths: - document.pdf expire_in: 1 week test_texlive2018: image: raabf/latex-versions:texlive2018 stage: build script: - pdflatex -interaction=nonstopmode document.tex - biber document - pdflatex -interaction=nonstopmode document.tex artifacts: paths: - document.pdf expire_in: 1 week
当出现以下错误时:
Authorization required, but no authorization protocol specified
在主机上运行:
bashxhost local:root
如果提示找不到显示,尝试修改 dockertexstudio.sh 中的显示设置:
将 --env='DISPLAY' 替换为 -e DISPLAY=unix$DISPLAY
如果遇到网络相关问题,尝试移除 --network=host 参数,但这可能导致 LanguageTool 等网络功能不可用。
如果上述方法仍有问题,尝试使用 x11docker:
bashx11docker --network=host --share $HOME raabf/texstudio-versions:texlive2021
该项目旨在为大多数 LaTeX 项目提供通用环境。如有任何缺失功能或问题,欢迎贡献。项目仓库和问题跟踪见 GitLab 仓库。
本项目采用 MIT 许可证。



manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务