Running Quarto Markdown in Docker
Run Quarto Markdown in Docker for easy documentation and slideshow generation. Learn to build your own Docker image and render Markdown to PDF, HTML, and Reveal.js.
This article is part of the Discovering Quarto series:
- Running Quarto Markdown in Docker
- Quarto conditional display
- Use Quarto and create a PowerPoint slideshow
- Using variables from external file in your Quarto project
- Some tips and tricks for Quarto when rendering as a reveal.js slideshow
- Quarto Callout Blocks
- Quarto includes short code
- Quarto Inline style
- My favorite Quarto extensions
- Using Mustache templating with Quarto
- Make your Quarto project Devcontainer-Ready — No More Setup Headaches
- Quarto - How I Built a Self-Documenting Ecosystem for 50+ Projects
Changelog

This article shows how to run Quarto (a Pandoc-based tool for converting Markdown into PDF, HTML, Word, ePub, or reveal.js slideshows) via Docker, either building a custom image from a Dockerfile or using a prebuilt ghcr.io/quarto-dev/quarto one. It walks through rendering the same Markdown file to PDF, HTML, and a multi-slide reveal.js presentation with quarto render test.md --to <format>.
Quarto is a tool for producing PDF, Word document, HTML web pages, ePub files, slideshows and many, many more outputs based on a Markdown file.
Using Quarto, you can render any Markdown content to a new PDF f.i.
Quarto supports a very large number of features, to which are added extensions from its community, making it a really practical tool for anyone wishing to produce documentation.
Personally, I haven't used a Word-type word processor for several years; nor have I used PowerPoint — I don't even know when the last time was.
And yet, I produce a great deal of documentation and slideshows. I write everything in Markdown and generate PDF or slideshows from the same content.
Until recently, I'd been using pandoc but, having taken the time to look around Quarto, it's a hell of a lot more powerful.
Like always on this blog, you will not install Quarto the old-fashioned way. You'll run it from a Docker image — and you don't even have to build that image yourself.
Render your first PDF, without installing anything
Create a temporary folder (mkdir -p /tmp/docker-quarto && cd $_), drop a Markdown file called test.md in it, and run:
A test.pdf file is now sitting next to your Markdown, owned by you, and it looks like this:

That image is the official Quarto one — nothing to build, nothing installed on your machine, and the container removes itself when the render is done.
Docker CLI reminder
As a reminder, the used Docker run command are (almost always the same):
-itto start Docker interactively, this will allow the script running in the container to ask you for some prompts f.i.,--rmto ask Docker to kill and remove the container as soon as the script has been executed (otherwise you'll have a lot of exited but not removed Docker containers; you can check this by not using the--rmflag then runningdocker container liston the console),-v .:/inputto share your current folder with a folder called/inputin the Docker container,-w /inputto tell Docker that the current directory, in the container, will be the/inputfolder,-u $(id -u):$(id -g)asks Docker to reuse your local credentials so when a file is updated/created in the container, the file will be owned by you,- then the name of the Quarto Docker image, and, finally,
quarto render test.md --to pdfi.e. the command line to start within the container.
Hide non-essential information
Add the --log-level warning CLI argument to Quarto to ask it to show only warning (and error) messages. Non-essential output will be hidden and you'll keep a clean console.
The source file
Here is the test.md used above:
# What is Quarto? Explain like I'm five
Imagine you want to write a story or a report, but instead of using a fancy computer program, you use plain text. That's kind of like Markdown, a simple language that lets you format your text without getting too complicated.
Now, Quarto is like a super-powered writing tool that understands Markdown and can also help you write code in different languages, like R or Python. It's like having a helper in your writing process, making things easier and more fun.
So, if you want to create documents, presentations, or even books, Quarto and Markdown can be your friends. They'll help you organize your thoughts, add cool features, and even share your work with the world.
Please refer to the official documentation of Quarto to get in-depth information about the Markdown it accepts.
The only thing that changes from one output format to the next is the --to argument.
The same file, as HTML and as a slideshow
Simply modify the --to argument and replace pdf by html: docker run -it --rm -v .:/input -w /input -u $(id -u):$(id -g) ghcr.io/quarto-dev/quarto:latest quarto render test.md --to html --log-level warning
Now, you've a test.html file in your directory.
For a slideshow, the --to argument should be set to revealjs: docker run -it --rm -v .:/input -w /input -u $(id -u):$(id -g) ghcr.io/quarto-dev/quarto:latest quarto render test.md --to revealjs --log-level warning
Open the test.html file and you'll get this:

Ok, you've just one slide now. Reopen the test.md file and you'll insert slide breaks. This can be done using the ---- syntax:
# What is Quarto? Explain like I'm five
Imagine you want to write a story or a report, but instead of using a fancy computer program, you use plain text. That's kind of like Markdown, a simple language that lets you format your text without getting too complicated.
----
Now, Quarto is like a super-powered writing tool that understands Markdown and can also help you write code in different languages, like R or Python. It's like having a helper in your writing process, making things easier and more fun.
----
So, if you want to create documents, presentations, or even books, Quarto and Markdown can be your friends. They'll help you organize your thoughts, add cool features, and even share your work with the world.
Rerun the --to revealjs command to regenerate the slideshow as a test.html file.
Information
Just run docker run -d --name static-site -p 8080:80 -v .:/usr/local/apache2/htdocs/ httpd:alpine then surf to http://127.0.0.1:8080/test.html to see your slideshow.
Now your slideshow will have three slides (press space or arrow keys for navigation):



Just deploy your slideshow online
The nice thing now is that your slideshow is ready to be deployed on your remote server. Copy the html file and the associated folder (in our use case here, file test.html and folder test_files) to your FTP server f.i. and your website can be publicly accessed. Nice, isn't it?
Build your own image (optional — skip it if the official one is enough)
There are a number of prebuilt images on the Internet to suit your needs. You'll find them at https://gitlab.com/quarto-forge/docker. The so-called Tier 0 image — the ghcr.io/quarto-dev/quarto:latest one used above — is suitable for generating html / revealjs output.
You'll want your own image the day you need something it doesn't ship: a LaTeX package for a specific PDF layout, R or Python for executable code cells, a font, a Quarto extension baked in.
Create a new file called Dockerfile (there is no extension) with this content:
# cspell:disable# Version number of Quarto to download and use# See https://github.com/quarto-dev/quarto-cli/pkgs/container/quarto for existing versionsARG QUARTO_VERSION=1.10.18
ARG OS_USERNAME=quartoARG UID=1000ARG GID=1000
FROM ghcr.io/quarto-dev/quarto:${QUARTO_VERSION}
# librsvg2-bin is to allow SVG conversion when rendering a PDF file# (will install the rsvg-view binary)RUN --mount=type=cache,target=/var/cache/apt,rw \ set -e -x && \ apt-get update -y \ && apt-get install -y --no-install-recommends \ ca-certificates \ git \ pandoc \ pandoc-citeproc \ curl \ gdebi-core \ librsvg2-bin \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*
USER root
# The input folder will be the one where we'll put our files before the conversion.# We should do this as root since it's a folder under /RUN set -e -x && \ mkdir -p /input
# Should be done for the user; won't work if done for root# (quarto will say that "tinytex is not installed")ARG OS_USERNAMEARG UIDARG GID
RUN set -e -x && \ groupadd -g ${GID} -o "${OS_USERNAME}" && \ useradd -l -m -u ${UID} -g ${GID} -o -s /bin/bash "${OS_USERNAME}"
USER "${OS_USERNAME}"
WORKDIR /
# Install tools like tinytex to allow conversion to PDFRUN set -e -x && \ quarto install tool tinytex --update-path && \ ~/.TinyTeX/bin/x86_64-linux/tlmgr update --self --all && \ ~/.TinyTeX/bin/x86_64-linux/fmtutil-sys --all && \ # See https://github.com/rstudio/tinytex/issues/426 for explanation # Run tlmgr install for a few tinyText packages (needed for PDF conversion) ~/.TinyTeX/bin/x86_64-linux/tlmgr install fvextra footnotebackref pagecolor sourcesanspro sourcecodepro titlingThis Dockerfile builds a container image based on Quarto that adds system packages for document conversion, creates a non-root user account for security, and installs LaTeX tools needed to convert documents to PDF format.
This done, please run docker build -t cavo789/quarto . and after something like three minutes the first time, you'll get your own Docker image:
Choose your own name
The previous instruction docker build -t cavo789/quarto . has created an image called cavo789/quarto. You can for sure choose a different name without any impact on the image.
From then on, every command of this article works the same: just replace ghcr.io/quarto-dev/quarto:latest by cavo789/quarto.
You can quickly check the size of your image; quite huge but except you're very low in memory / disk space; this is really not a big deal.
Going further
One Markdown file, three --to values, three completely different deliverables — and not a single application installed on your machine. That's the part I still find remarkable: the source of my PDF, my web page and my slideshow is the same text file, so they can never drift apart.
Once you're comfortable running Quarto in a plain Docker container, two natural next steps are turning that setup into a proper VSCode devcontainer (open the project, everything is preinstalled and hot-reload works out of the box), and browsing my favorite Quarto extensions to enhance your documentation. For the slideshow side in depth, see Level Up Your Presentations with Quarto, reveal.js, Decktape, Docker and DevContainers.
This article is part of the Discovering Quarto series:
- Running Quarto Markdown in Docker
- Quarto conditional display
- Use Quarto and create a PowerPoint slideshow
- Using variables from external file in your Quarto project
- Some tips and tricks for Quarto when rendering as a reveal.js slideshow
- Quarto Callout Blocks
- Quarto includes short code
- Quarto Inline style
- My favorite Quarto extensions
- Using Mustache templating with Quarto
- Make your Quarto project Devcontainer-Ready — No More Setup Headaches
- Quarto - How I Built a Self-Documenting Ecosystem for 50+ Projects





