{"id":14069874,"url":"https://github.com/analythium/quarto-docker-examples","last_synced_at":"2026-01-07T15:58:23.037Z","repository":{"id":49832882,"uuid":"517485344","full_name":"analythium/quarto-docker-examples","owner":"analythium","description":"Quarto Examples with Docker","archived":false,"fork":false,"pushed_at":"2022-07-31T22:18:36.000Z","size":67,"stargazers_count":27,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-04T11:38:00.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TeX","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/analythium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-25T01:57:29.000Z","updated_at":"2024-10-12T08:17:19.000Z","dependencies_parsed_at":"2022-09-01T01:11:22.445Z","dependency_job_id":null,"html_url":"https://github.com/analythium/quarto-docker-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/analythium/quarto-docker-examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fquarto-docker-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fquarto-docker-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fquarto-docker-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fquarto-docker-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/analythium","download_url":"https://codeload.github.com/analythium/quarto-docker-examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/analythium%2Fquarto-docker-examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267822931,"owners_count":24149721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:07:18.462Z","updated_at":"2026-01-07T15:58:22.996Z","avatar_url":"https://github.com/analythium.png","language":"TeX","funding_links":[],"categories":["TeX"],"sub_categories":[],"readme":"# Quarto Examples with Docker\n\nThis repository contains supporting material ofr the following blog posts on the _Hosting Data Apps_ ([hosting.analythium.io](https://hosting.analythium.io/)) website:\n\n- [How to Set Up Quarto with Docker, Part 1: Static Content](https://hosting.analythium.io/how-to-set-up-quarto-with-docker-part-1-static-content/)\n- [How to Set Up Quarto with Docker, Part 2: Dynamic Content](https://hosting.analythium.io/how-to-set-up-quarto-with-docker-part-2-dynamic-content)\n\n[Quarto](https://quarto.org/) is is an open-source scientific and technical publishing system built on [Pandoc](https://pandoc.org/).\n\nThe examples in this repository focus on R related Quarto documents. We review the different options for dockerizing static and interactive Quarto documents.\n\n- [Quarto Examples with Docker](#quarto-examples-with-docker)\n  - [Create a Quarto parent image](#create-a-quarto-parent-image)\n  - [Render a static file](#render-a-static-file)\n  - [Render a static project](#render-a-static-project)\n    - [Website](#website)\n      - [Option 1: local rendering](#option-1-local-rendering)\n      - [Option 2: render inside Docker](#option-2-render-inside-docker)\n    - [Book](#book)\n      - [Option 1: local rendering](#option-1-local-rendering-1)\n      - [Option 2: render inside Docker](#option-2-render-inside-docker-1)\n  - [Render an interactive file with widgets](#render-an-interactive-file-with-widgets)\n  - [Server: Shiny](#server-shiny)\n  - [Shiny prerendered](#shiny-prerendered)\n\n## Create a Quarto parent image\n\nWe build a parent image with Quarto installed so that we can use this image in subsequent `FROM` instructions.\n\nThe `Dockerfile.base` is based on a Ubuntu based image.\n\nThis part in the Dockerfile will [install](https://docs.rstudio.com/resources/install-quarto/#quarto-deb-file-install) the Quarto command line tool:\n\n```dockerfile\n...\nRUN curl -LO https://quarto.org/download/latest/quarto-linux-amd64.deb\nRUN gdebi --non-interactive quarto-linux-amd64.deb\n...\n```\n\nIf you want a specific version, use:\n\n```dockerfile\n...\nARG QUARTO_VERSION=\"0.9.522\"\nRUN curl -o quarto-linux-amd64.deb -L https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb\nRUN gdebi --non-interactive quarto-linux-amd64.deb\n...\n```\n\nNow we can build the image:\n\n```bash\ndocker build \\\n    -f Dockerfile.base \\\n    -t analythium/r2u-quarto:20.04 .\n```\n\nRun the container interactively to check the installation:\n\n```bash\ndocker run -it --rm analythium/r2u-quarto:20.04 bash\n```\n\nType `quarto check`, you should see check marks:\n\n```bash\nroot@d8377016be7f:/# quarto check\n\n[✓] Checking Quarto installation......OK\n      Version: 1.0.36\n      Path: /opt/quarto/bin\n\n[✓] Checking basic markdown render....OK\n\n[✓] Checking Python 3 installation....OK\n      Version: 3.8.10\n      Path: /usr/bin/python3\n      Jupyter: (None)\n\n      Jupyter is not available in this Python installation.\n      Install with python3 -m pip install jupyter\n\n[✓] Checking R installation...........OK\n      Version: 4.2.1\n      Path: /usr/lib/R\n      LibPaths:\n        - /usr/local/lib/R/site-library\n        - /usr/lib/R/site-library\n        - /usr/lib/R/library\n      rmarkdown: 2.14\n\n[✓] Checking Knitr engine render......OK\n```\n\nType `exit` to quit the session.\n\n## Render a static file\n\nRender the R example for [air quality](https://quarto.org/docs/computations/r.html):\n\n```bash\ndocker build \\\n    -f Dockerfile.static-file \\\n    -t analythium/quarto:static-file .\n\ndocker run -p 8080:8080 analythium/quarto:static-file\n```\n\n## Render a static project\n\nProjects contain multiple files, like [website](https://quarto.org/docs/reference/projects/websites.html) and [books](https://quarto.org/docs/reference/projects/books.html).\n\n### Website\n\nUse the following command to create a website template locally: `quarto create-project static-website --type website`.\n\n#### Option 1: local rendering\n\nRender the project as `quarto render static-website --output-dir output`.\n\nThen use this Dockerfile:\n\n```bash\nFROM ghcr.io/openfaas/of-watchdog:0.9.6 AS watchdog\nFROM alpine:latest\nRUN mkdir /app\nCOPY static-website/output /app\nCOPY --from=watchdog /fwatchdog .\nENV mode=\"static\"\nENV static_path=\"/app\"\nHEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1\nCMD [\"./fwatchdog\"]\n```\n\n#### Option 2: render inside Docker\n\n```bash\ndocker build \\\n    -f Dockerfile.static-website \\\n    -t analythium/quarto:static-website .\n\ndocker run -p 8080:8080 analythium/quarto:static-website\n```\n\n### Book\n\nUse the following command to create a book template locally: `quarto create-project static-book --type book`.\n\n#### Option 1: local rendering\n\nRender the project as `quarto render static-book --output-dir output`.\n\nThen use this Dockerfile:\n\n```bash\nFROM ghcr.io/openfaas/of-watchdog:0.9.6 AS watchdog\nFROM alpine:latest\nRUN mkdir /app\nCOPY static-book/output /app\nCOPY --from=watchdog /fwatchdog .\nENV mode=\"static\"\nENV static_path=\"/app\"\nHEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1\nCMD [\"./fwatchdog\"]\n```\n\n#### Option 2: render inside Docker\n\nNote: we need a LaTeX installation, so we add `quarto install tool tinytex` to the Dockerfile:\n\n```bash\ndocker build \\\n    -f Dockerfile.static-book \\\n    -t analythium/quarto:static-book .\n\ndocker run -p 8080:8080 analythium/quarto:static-book\n```\n\n## Render an interactive file with widgets\n\nRender an [interactive](https://quarto.org/docs/interactive/widgets/htmlwidgets.html) but static file:\n\n```bash\ndocker build \\\n    -f Dockerfile.static-widget \\\n    -t analythium/quarto:static-widget .\n\ndocker run -p 8080:8080 analythium/quarto:static-widget\n```\n\n## Server: Shiny\n\nYou can specify [Shiny](https://quarto.org/docs/interactive/shiny/) as the engine to run the dynamic Quarto document.\n\nIn this example we do not render the Quarto document up front. The render step will happen when the container is spin up. This is analogous to the R Markdown Shiny runtime.\n\nWe use the `quarto serve index.qmd --port 8080 --host 0.0.0.0` command to specify port and host IPv4 address. The `quarto serve` function will render the document  before serving.\n\nThis example shows the classic Old Faithful histogram with the slider.\n\n```bash\ndocker build -f Dockerfile.shiny -t analythium/quarto:shiny .\n\ndocker run -p 8080:8080 analythium/quarto:shiny\n```\n\nIf you can't kill the container with `Ctrl+C`, try getting the container ID with `docker ps` and then use `docker kill $ID`.\n\nNote: you can serve the doc from R with `quarto::quarto_serve(\"index.qmd\")`.\n\n## Shiny prerendered\n\nDepending on the complexity of your document, rendering at the container launch time will significantly increase \"cold start\" time. But we can render the document as part of the Docker build process. This is analogous to the R Markdown prerendered Shiny runtime (shinyrmd).\n\nWhen we render the file, the UI elements get rendered, while the code chunks marked as `context: server` will wait until the rendered document is served. Read more about [render and server contexts](https://quarto.org/docs/interactive/shiny/execution.html#sharing-code).\n\nThis example shows k-means clustering with [custom page layout](https://quarto.org/docs/interactive/layout.html).\n\n`quarto serve` is called with the `--no-render` flag to avoid unnecessary rendering.\n\n```bash\ndocker build \\\n  -f Dockerfile.shiny-prerendered \\\n  -t analythium/quarto:shiny-prerendered .\n\ndocker run -p 8080:8080 analythium/quarto:shiny-prerendered\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalythium%2Fquarto-docker-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanalythium%2Fquarto-docker-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanalythium%2Fquarto-docker-examples/lists"}