I am trying to dockerize an Rstudio container, where a quarto document will be rendered to pdf. Everything else in the container runs fine, however, when I try to render the quarto document, I get this error:
running xelatex - 1
No TeX installation was detected.
Please run 'quarto install tinytex' to install TinyTex.
If you prefer, you may install TexLive or another TeX distribution.
This is my Dockerfile:
FROM rocker/tidyverse:4.3.2
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
&& install2.r --error --skipmissing --deps TRUE --skipinstalled \
tidyverse \
car \
corrplot \
cowplot \
tidymodels \
knitr \
kableExtra \
testthat \
docopt
RUN Rscript -e 'tinytex::install_tinytex()'
I have tried adding the following lines to the Dockerfile on separate occasions but none of them worked.
RUN install2.r --error --skipmissing --deps TRUE --skipinstalled tinytex
RUN quarto install tinytex
RUN apt-get wget
RUN wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh
🗎 Dockerfile
FROM rocker/tidyverse:4.3.2
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
&& install2.r --error --skipmissing --deps TRUE --skipinstalled \
tidyverse \
car \
corrplot \
cowplot \
tidymodels \
knitr \
kableExtra \
testthat \
docopt
RUN Rscript -e 'tinytex::install_tinytex()'
ENV PATH="${PATH}:/root/bin"
RUN tlmgr update --self
RUN tlmgr update --all
RUN tlmgr install \
koma-script \
caption \
pgf \
environ \
tikzfill \
tcolorbox \
pdfcol
# TEST ========================================================================
COPY minimal.qmd .
CMD quarto render minimal.qmd
🗎 minimal.qmd
---
title: "Minimal Quarto Document"
format: pdf
---
# Introduction
This is a test document.
Okay, so that works. But what if you want to mount a volume with the markdown file and render it from RStudio?
Update Dockerfile
.
FROM rocker/tidyverse:4.3.2
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
&& install2.r --error --skipmissing --deps TRUE --skipinstalled \
tidyverse \
car \
corrplot \
cowplot \
tidymodels \
knitr \
kableExtra \
testthat \
docopt
USER rstudio
RUN Rscript -e 'tinytex::install_tinytex()'
ENV PATH="${PATH}:/home/rstudio/bin"
RUN tlmgr update --self
RUN tlmgr update --all
RUN tlmgr install \
koma-script \
caption \
pgf \
environ \
tikzfill \
tcolorbox \
pdfcol
USER root
The LaTeX distribution is being installed as the rstudio
user.
Build and launch.
docker build -t rstudio-tinytex .
docker run -it --rm \
-e PASSWORD=password \
-p 8787:8787 \
-v $(pwd):/home/rstudio/workspace \
rstudio-tinytex
Navigate to http://127.0.0.1:8787/ and login with user rstudio
and password password
(you can set something more secure via the PASSWORD
environment variable). Then within RStudio go to the workspace/
directory, open the file and render.