Configurations
Every devcontainer.json in the repository, and how to write your own.
Shipped configurations
Codespaces uses .devcontainer/devcontainer.json unless you select another path, either through the devcontainer_path URL parameter or the creation dialog. See GitHub Codespaces for both routes.
Every configuration except universal and the build recipe is the same file with one value changed: the version passed to the quarto-cli Dev Container feature. They all start from the prebuilt image, so switching between them costs a feature reinstall rather than a full image build.
The default configuration
.devcontainer/devcontainer.json pulls ghcr.io/mcanouil/quarto-codespaces:latest, runs as vscode, and reinstalls Quarto at the stable release:
{
"name": "Release - Quarto Codespaces",
"image": "ghcr.io/mcanouil/quarto-codespaces:latest",
"remoteUser": "vscode",
"features": {
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
"version": "release"
}
}
}It also installs a fixed editor setup, shared by all the image-based configurations.
Extensions
quarto.quarto, mcanouil.quarto-wizard, REditorSupport.r, Posit.air-vscode, ms-python.python, ms-python.vscode-pylance, ms-python.black-formatter, ms-python.flake8, ms-python.pylint, ms-python.isort, ms-toolsai.jupyter, and julialang.language-julia.
Settings
{
"r.rterm.option": ["--no-save", "--no-restore-data", "--quiet"],
"r.useRenvLibPath": true,
"[r]": {
"editor.defaultFormatter": "Posit.air-vscode",
"editor.formatOnSave": true
}
}r.useRenvLibPath makes the R extension follow a project-local renv library, which is what init-env.sh creates.
The universal configuration
.devcontainer/universal/devcontainer.json differs from the others in several ways.
- It builds from
mcr.microsoft.com/devcontainers/universal:latestinstead of pulling this project’s image, because Codespaces already caches Microsoft’s base image; using it keeps your storage quota down at the cost of a longer first start. - The remote user is
codespace, notvscode. - It vendors its own copies of the
quarto-computing-dependenciesanduvfeatures, and restricts the computing dependencies toinstallOnPlatforms: amd64. - It installs two extra R packages,
promptandlintr, on top ofrmarkdownandlanguageserver. - It lets the
quarto-clifeature install TinyTeX (installTinyTex: true) rather than using this project’stinytexfeature, and skips Chromium.
The build recipe
.github/.devcontainer/devcontainer.json is not meant to be opened as a development environment. It is the recipe the container images are built from: it starts at buildpack-deps:noble-curl, layers every feature, and reads the Quarto version, the remote user, and all the OCI annotations from environment variables supplied by the build workflow.
Write your own
Start from an existing file and change what you need.
{
"name": "Custom Quarto setup",
"image": "ghcr.io/mcanouil/quarto-codespaces:latest",
"remoteUser": "vscode",
"features": {
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
"version": "1.9"
}
},
"containerEnv": {
"QUARTO_PRINT_STACK": "true"
},
"customizations": {
"vscode": {
"extensions": ["quarto.quarto", "mcanouil.quarto-wizard"],
"settings": {}
}
}
}The parts worth changing:
- Base image: set
imageto a published tag, or replace it withbuildand a Dockerfile. - Features: add Dev Container features, or drop the
quarto-clifeature to keep the version baked into the image. - Extensions and settings: under
customizations.vscode. - Environment variables: under
containerEnvfor the container, orremoteEnvfor the editor session.