Follow the steps below to set up a docker environment with RStudio to render your Quarto documents (.qmd). It allows you to knit Rmd documents too.
You should follow all steps exactly in the order they appear here, otherwise it may not work.
# In the terminal, get to the directory that contains your Rmd or quarto document and the files needed,
# and run the below command
docker run -it --rm -p 8787:8787 -e PASSWORD=1234 -v $(pwd):/home/rstudio/work rocker/tidyverse:4.2.1
# In another terminal, search for the name of the container created for Rstudio (it will be a hash code)
docker ps
# Copy the container name (hash) to connect to it via command line with the below command
docker exec -it -u root _hash_do_contêiner_ bash
# In the same terminal, get quarto program to be installed
wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.433/quarto-1.3.433-linux-amd64.deb
# Install it
sudo dpkg -i quarto-1.3.433-linux-amd64.deb
# In your browser, access 127.0.0.1:8787 to open RStudio. User: rstudio | Password: 1234
# Now, in the R Console in RStudio, install markdown and tinytex to render the pdf.
install.packages("markdown")
tinytex::install_tinytex()
# Authorize your browser to show pop-ups, once that the pdf after rendering will appear in a new window or tab
# Click on Render to create your pdf from the quarto document in RStudio (top left panel, blue arrow)