From e52ca43e256dbe41df3b1378fea128abe260d3bd Mon Sep 17 00:00:00 2001 From: Seth Shelnutt Date: Fri, 27 Mar 2026 19:42:18 +0000 Subject: [PATCH 01/11] feat(templates): add docker-rstudio template with code-server and RMarkdown Add a new Docker-based template for R development that provisions a workspace with RStudio Server, code-server, and RMarkdown pre-configured. The template uses the rocker/rstudio image which ships R and RStudio Server pre-installed, and leverages the code-server registry module for VS Code in the browser. RMarkdown is installed on first start and persisted in the home-directory R library across restarts. --- .../coder/templates/docker-rstudio/README.md | 79 ++++++ .../coder/templates/docker-rstudio/main.tf | 244 ++++++++++++++++++ 2 files changed, 323 insertions(+) create mode 100644 registry/coder/templates/docker-rstudio/README.md create mode 100644 registry/coder/templates/docker-rstudio/main.tf diff --git a/registry/coder/templates/docker-rstudio/README.md b/registry/coder/templates/docker-rstudio/README.md new file mode 100644 index 000000000..802967ee4 --- /dev/null +++ b/registry/coder/templates/docker-rstudio/README.md @@ -0,0 +1,79 @@ +--- +display_name: Docker RStudio +description: Provision Docker containers with RStudio, code-server, and RMarkdown +icon: ../../../../.icons/rstudio.svg +verified: true +tags: [docker, rstudio, r, rmarkdown, code-server] +--- + +# R Development on Docker Containers + +Provision Docker containers pre-configured for R development as [Coder workspaces](https://coder.com/docs/workspaces) with this template. + +Each workspace comes with: + +- **RStudio Server** — full-featured R IDE in the browser. +- **code-server** — VS Code in the browser for general editing. +- **RMarkdown** — author reproducible documents, reports, and presentations. + +The workspace is based on the [rocker/rstudio](https://rocker-project.org/) image, which ships R and RStudio Server pre-installed. + +## Prerequisites + +### Infrastructure + +#### Running Coder inside Docker + +If you installed Coder as a container within Docker, you will have to do the following things: + +- Make the Docker socket available to the container + - **(recommended) Mount `/var/run/docker.sock` via `--mount`/`volume`** + - _(advanced) Restrict the Docker socket via https://github.com/Tecnativa/docker-socket-proxy_ +- Set `--group-add`/`group_add` to the GID of the Docker group on the **host** machine + - You can get the GID by running `getent group docker` on the **host** machine + +#### Running Coder outside of Docker + +If you installed Coder as a system package, the VM you run Coder on must have a running Docker socket and the `coder` user must be added to the Docker group: + +```sh +# Add coder user to Docker group +sudo adduser coder docker + +# Restart Coder server +sudo systemctl restart coder + +# Test Docker +sudo -u coder docker ps +``` + +## Architecture + +This template provisions the following resources: + +- Docker image (`rocker/rstudio` — includes R and RStudio Server) +- Docker container (ephemeral — destroyed on workspace stop) +- Docker volume (persistent on `/home/rstudio`) + +When the workspace restarts, tools and files outside `/home/rstudio` are not persisted. The R library path defaults to a subdirectory of the home folder, so installed packages (including RMarkdown) survive restarts. + +> [!NOTE] +> This template is designed to be a starting point! Edit the Terraform to extend it for your use case. + +## Customization + +### Changing the R version + +Set the `rstudio_version` variable to any valid [rocker/rstudio tag](https://hub.docker.com/r/rocker/rstudio/tags) (for example `4.4.2`, `4.3`, or `latest`). + +### Installing additional R packages + +Add `install.packages()` calls to the `startup_script` in the `coder_agent` resource. Packages installed under the home directory are persisted across restarts. + +### Adding LaTeX for PDF rendering + +RMarkdown can render PDF output when LaTeX is available. Add the following to the startup script to install TinyTeX: + +```sh +R --quiet -e "if (!require('tinytex', quietly = TRUE)) { install.packages('tinytex', repos = 'https://cloud.r-project.org'); tinytex::install_tinytex() }" +``` diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf new file mode 100644 index 000000000..8307ff5d3 --- /dev/null +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -0,0 +1,244 @@ +terraform { + required_providers { + coder = { + source = "coder/coder" + } + docker = { + source = "kreuzwerker/docker" + } + } +} + +locals { + username = data.coder_workspace_owner.me.name +} + +variable "docker_socket" { + default = "" + description = "(Optional) Docker socket URI" + type = string +} + +variable "rstudio_version" { + default = "4" + description = "The rocker/rstudio image tag to use (e.g. 4, 4.4, 4.4.2)" + type = string +} + +provider "docker" { + # Defaulting to null if the variable is an empty string lets us + # have an optional variable without having to set our own default. + host = var.docker_socket != "" ? var.docker_socket : null +} + +data "coder_provisioner" "me" {} +data "coder_workspace" "me" {} +data "coder_workspace_owner" "me" {} + +resource "coder_agent" "main" { + arch = data.coder_provisioner.me.arch + os = "linux" + startup_script = <<-EOT + set -e + + # Prepare user home with default files on first start. + if [ ! -f ~/.init_done ]; then + cp -rT /etc/skel ~ 2>/dev/null || true + touch ~/.init_done + fi + + # Start RStudio Server. The rocker/rstudio image ships the + # server pre-installed. We disable authentication because + # the Coder proxy handles access control. + if command -v rserver > /dev/null 2>&1; then + sudo rserver \ + --server-daemonize=0 \ + --auth-none=1 \ + --www-port=8787 \ + --server-user=$(whoami) & + elif [ -x /usr/lib/rstudio-server/bin/rserver ]; then + sudo /usr/lib/rstudio-server/bin/rserver \ + --server-daemonize=0 \ + --auth-none=1 \ + --www-port=8787 \ + --server-user=$(whoami) & + fi + + # Install RMarkdown if it is not already available. The + # installation is persisted in the home-directory R library + # so it only runs once per workspace. + R --quiet -e "if (!require('rmarkdown', quietly = TRUE)) install.packages('rmarkdown', repos = 'https://cloud.r-project.org')" + EOT + + # These environment variables allow you to make Git commits + # right away after creating a workspace. They take precedence + # over configuration in ~/.gitconfig. Remove this block if + # you prefer to configure Git manually or via dotfiles. + env = { + GIT_AUTHOR_NAME = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name) + GIT_AUTHOR_EMAIL = "${data.coder_workspace_owner.me.email}" + GIT_COMMITTER_NAME = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name) + GIT_COMMITTER_EMAIL = "${data.coder_workspace_owner.me.email}" + } + + metadata { + display_name = "CPU Usage" + key = "0_cpu_usage" + script = "coder stat cpu" + interval = 10 + timeout = 1 + } + + metadata { + display_name = "RAM Usage" + key = "1_ram_usage" + script = "coder stat mem" + interval = 10 + timeout = 1 + } + + metadata { + display_name = "Home Disk" + key = "3_home_disk" + script = "coder stat disk --path $${HOME}" + interval = 60 + timeout = 1 + } + + metadata { + display_name = "CPU Usage (Host)" + key = "4_cpu_usage_host" + script = "coder stat cpu --host" + interval = 10 + timeout = 1 + } + + metadata { + display_name = "Memory Usage (Host)" + key = "5_mem_usage_host" + script = "coder stat mem --host" + interval = 10 + timeout = 1 + } + + metadata { + display_name = "Load Average (Host)" + key = "6_load_host" + # Get load average scaled by number of cores. + script = < Date: Mon, 30 Mar 2026 14:44:49 -0400 Subject: [PATCH 02/11] Update registry/coder/templates/docker-rstudio/main.tf Co-authored-by: DevCats --- registry/coder/templates/docker-rstudio/main.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf index 8307ff5d3..0f5502583 100644 --- a/registry/coder/templates/docker-rstudio/main.tf +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -167,7 +167,6 @@ module "code-server" { version = "~> 1.0" agent_id = coder_agent.main.id - agent_name = "main" order = 2 folder = "/home/rstudio" } From 8f896333f53ca7f84ad66ccbd72695f8020494f8 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 19:22:58 +0000 Subject: [PATCH 03/11] chore: run terraform fmt on docker-rstudio template --- registry/coder/templates/docker-rstudio/main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf index 0f5502583..f5bae6ae4 100644 --- a/registry/coder/templates/docker-rstudio/main.tf +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -166,9 +166,9 @@ module "code-server" { # to prevent breaking changes in production. version = "~> 1.0" - agent_id = coder_agent.main.id - order = 2 - folder = "/home/rstudio" + agent_id = coder_agent.main.id + order = 2 + folder = "/home/rstudio" } resource "docker_image" "main" { From 077adacb282d0e29e4b6ded5895a85d4ac77ab70 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 19:40:53 +0000 Subject: [PATCH 04/11] fix: add Dockerfile to bake curl and cmake into the image The rocker/rstudio base image does not ship with curl or cmake. curl is required by the code-server module to download the install script, and cmake is needed to compile the R "fs" package (a transitive dependency of rmarkdown). Because all coder_script resources run in parallel via errgroup, there is no way to guarantee an apt-get install in the startup_script finishes before the code-server module tries to use curl. Building a custom image with these dependencies baked in is the only reliable fix. --- .../coder/templates/docker-rstudio/build/Dockerfile | 8 ++++++++ registry/coder/templates/docker-rstudio/main.tf | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 registry/coder/templates/docker-rstudio/build/Dockerfile diff --git a/registry/coder/templates/docker-rstudio/build/Dockerfile b/registry/coder/templates/docker-rstudio/build/Dockerfile new file mode 100644 index 000000000..5ccc7d467 --- /dev/null +++ b/registry/coder/templates/docker-rstudio/build/Dockerfile @@ -0,0 +1,8 @@ +ARG RSTUDIO_VERSION=4 +FROM rocker/rstudio:${RSTUDIO_VERSION} + +RUN apt-get update \ + && apt-get install -y \ + curl \ + cmake \ + && rm -rf /var/lib/apt/lists/* diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf index f5bae6ae4..11f056b22 100644 --- a/registry/coder/templates/docker-rstudio/main.tf +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -172,7 +172,16 @@ module "code-server" { } resource "docker_image" "main" { - name = "rocker/rstudio:${var.rstudio_version}" + name = "coder-${data.coder_workspace.me.id}-rstudio" + build { + context = "./build" + build_args = { + RSTUDIO_VERSION = var.rstudio_version + } + } + triggers = { + dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1(f)])) + } } resource "docker_volume" "home_volume" { From 07580e7477464c788a3571643d68bf5943d38186 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 19:52:55 +0000 Subject: [PATCH 05/11] docs: document Dockerfile and how to add system dependencies --- .../coder/templates/docker-rstudio/README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/registry/coder/templates/docker-rstudio/README.md b/registry/coder/templates/docker-rstudio/README.md index 802967ee4..77df6e52f 100644 --- a/registry/coder/templates/docker-rstudio/README.md +++ b/registry/coder/templates/docker-rstudio/README.md @@ -51,7 +51,7 @@ sudo -u coder docker ps This template provisions the following resources: -- Docker image (`rocker/rstudio` — includes R and RStudio Server) +- Docker image (built from `build/Dockerfile`, extending `rocker/rstudio` with system dependencies) - Docker container (ephemeral — destroyed on workspace stop) - Docker volume (persistent on `/home/rstudio`) @@ -70,6 +70,21 @@ Set the `rstudio_version` variable to any valid [rocker/rstudio tag](https://hub Add `install.packages()` calls to the `startup_script` in the `coder_agent` resource. Packages installed under the home directory are persisted across restarts. +### Adding system dependencies + +The `build/Dockerfile` extends the `rocker/rstudio` base image with system packages required by modules (e.g. `curl` for code-server, `cmake` for R package compilation). If you add modules that need additional system-level tools, add them to the `Dockerfile`: + +```dockerfile +RUN apt-get update \ + && apt-get install -y \ + curl \ + cmake \ + your-package-here \ + && rm -rf /var/lib/apt/lists/* +``` + +The image is automatically rebuilt when the Dockerfile changes. + ### Adding LaTeX for PDF rendering RMarkdown can render PDF output when LaTeX is available. Add the following to the startup script to install TinyTeX: From 67a672d204556becaf20d4ad7bdf2b0f545c5d6a Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:20:39 +0000 Subject: [PATCH 06/11] fix: bake rmarkdown into the Docker image instead of installing at startup Moves the rmarkdown install from the startup_script into the Dockerfile. This eliminates ~14k lines of R package compilation logs on every workspace start and lets the workspace go healthy immediately instead of blocking on source compilation of 25 R package dependencies. --- registry/coder/templates/docker-rstudio/README.md | 8 +++++++- registry/coder/templates/docker-rstudio/build/Dockerfile | 2 ++ registry/coder/templates/docker-rstudio/main.tf | 5 ----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/registry/coder/templates/docker-rstudio/README.md b/registry/coder/templates/docker-rstudio/README.md index 77df6e52f..3b9edf9ec 100644 --- a/registry/coder/templates/docker-rstudio/README.md +++ b/registry/coder/templates/docker-rstudio/README.md @@ -68,7 +68,13 @@ Set the `rstudio_version` variable to any valid [rocker/rstudio tag](https://hub ### Installing additional R packages -Add `install.packages()` calls to the `startup_script` in the `coder_agent` resource. Packages installed under the home directory are persisted across restarts. +R packages are pre-installed via the `build/Dockerfile` so they are available immediately when the workspace starts. To add more packages, add `install.packages()` calls to the Dockerfile: + +```dockerfile +RUN R -e "install.packages(c('tidyverse', 'shiny'), repos = 'https://cloud.r-project.org')" +``` + +Packages installed at build time avoid long startup delays from compiling R packages from source on every workspace start. ### Adding system dependencies diff --git a/registry/coder/templates/docker-rstudio/build/Dockerfile b/registry/coder/templates/docker-rstudio/build/Dockerfile index 5ccc7d467..01ccd665a 100644 --- a/registry/coder/templates/docker-rstudio/build/Dockerfile +++ b/registry/coder/templates/docker-rstudio/build/Dockerfile @@ -6,3 +6,5 @@ RUN apt-get update \ curl \ cmake \ && rm -rf /var/lib/apt/lists/* + +RUN R -e "install.packages('rmarkdown', repos = 'https://cloud.r-project.org')" diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf index 11f056b22..7bc6353dd 100644 --- a/registry/coder/templates/docker-rstudio/main.tf +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -63,11 +63,6 @@ resource "coder_agent" "main" { --www-port=8787 \ --server-user=$(whoami) & fi - - # Install RMarkdown if it is not already available. The - # installation is persisted in the home-directory R library - # so it only runs once per workspace. - R --quiet -e "if (!require('rmarkdown', quietly = TRUE)) install.packages('rmarkdown', repos = 'https://cloud.r-project.org')" EOT # These environment variables allow you to make Git commits From e8480c327bfaf7f6c1641a3bc4b94ebed76fb94a Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:55:41 +0000 Subject: [PATCH 07/11] fix: use default Posit Package Manager repo for binary R package installs The rocker/rstudio image is pre-configured to use Posit Package Manager (p3m.dev) which serves pre-compiled binary R packages. Dropping the explicit repos argument avoids overriding this with CRAN source, which was forcing full source compilation. --- registry/coder/templates/docker-rstudio/README.md | 4 ++-- registry/coder/templates/docker-rstudio/build/Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/registry/coder/templates/docker-rstudio/README.md b/registry/coder/templates/docker-rstudio/README.md index 3b9edf9ec..26d2cd743 100644 --- a/registry/coder/templates/docker-rstudio/README.md +++ b/registry/coder/templates/docker-rstudio/README.md @@ -71,10 +71,10 @@ Set the `rstudio_version` variable to any valid [rocker/rstudio tag](https://hub R packages are pre-installed via the `build/Dockerfile` so they are available immediately when the workspace starts. To add more packages, add `install.packages()` calls to the Dockerfile: ```dockerfile -RUN R -e "install.packages(c('tidyverse', 'shiny'), repos = 'https://cloud.r-project.org')" +RUN R -e "install.packages(c('tidyverse', 'shiny'))" ``` -Packages installed at build time avoid long startup delays from compiling R packages from source on every workspace start. +The image is pre-configured to use [Posit Package Manager](https://packagemanager.posit.co/) which provides pre-compiled binary packages for fast installation. Packages installed at build time avoid long startup delays from compiling from source on every workspace start. ### Adding system dependencies diff --git a/registry/coder/templates/docker-rstudio/build/Dockerfile b/registry/coder/templates/docker-rstudio/build/Dockerfile index 01ccd665a..a87e5738e 100644 --- a/registry/coder/templates/docker-rstudio/build/Dockerfile +++ b/registry/coder/templates/docker-rstudio/build/Dockerfile @@ -7,4 +7,4 @@ RUN apt-get update \ cmake \ && rm -rf /var/lib/apt/lists/* -RUN R -e "install.packages('rmarkdown', repos = 'https://cloud.r-project.org')" +RUN R -e "install.packages('rmarkdown')" From 670c75d81db146687adcb41d3cc5feb3e3f1fe7e Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:10:24 +0000 Subject: [PATCH 08/11] fix: remove triggers block that causes panic in Coder preview The fileset/filesha1 triggers block causes a nil pointer dereference in Coder dynamic parameters preview due to the fileset stub returning cty.String instead of cty.Set(cty.String). Since each workspace builds its own image on every start, the triggers block is not needed. --- registry/coder/templates/docker-rstudio/README.md | 2 -- registry/coder/templates/docker-rstudio/main.tf | 3 --- 2 files changed, 5 deletions(-) diff --git a/registry/coder/templates/docker-rstudio/README.md b/registry/coder/templates/docker-rstudio/README.md index 26d2cd743..98d60f88c 100644 --- a/registry/coder/templates/docker-rstudio/README.md +++ b/registry/coder/templates/docker-rstudio/README.md @@ -89,8 +89,6 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* ``` -The image is automatically rebuilt when the Dockerfile changes. - ### Adding LaTeX for PDF rendering RMarkdown can render PDF output when LaTeX is available. Add the following to the startup script to install TinyTeX: diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf index 7bc6353dd..2226d55cd 100644 --- a/registry/coder/templates/docker-rstudio/main.tf +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -174,9 +174,6 @@ resource "docker_image" "main" { RSTUDIO_VERSION = var.rstudio_version } } - triggers = { - dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1(f)])) - } } resource "docker_volume" "home_volume" { From 425ae93467ce926605e05851320dae99cf08ca20 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:24:47 +0000 Subject: [PATCH 09/11] fix: redirect rserver output to prevent startup script pipe warning rserver with --server-daemonize=0 holds stdout/stderr open when backgrounded, causing Coder to warn about unclosed output pipes after the startup script exits. Redirecting to /tmp/rserver.log fixes this. --- registry/coder/templates/docker-rstudio/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf index 2226d55cd..075867c03 100644 --- a/registry/coder/templates/docker-rstudio/main.tf +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -55,13 +55,13 @@ resource "coder_agent" "main" { --server-daemonize=0 \ --auth-none=1 \ --www-port=8787 \ - --server-user=$(whoami) & + --server-user=$(whoami) > /tmp/rserver.log 2>&1 & elif [ -x /usr/lib/rstudio-server/bin/rserver ]; then sudo /usr/lib/rstudio-server/bin/rserver \ --server-daemonize=0 \ --auth-none=1 \ --www-port=8787 \ - --server-user=$(whoami) & + --server-user=$(whoami) > /tmp/rserver.log 2>&1 & fi EOT From ab72ec4f4dfce23ba48956398ceebf435d020474 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 21:52:04 +0000 Subject: [PATCH 10/11] fix: use rstudio user for rserver instead of whoami The Coder agent runs as root, so $(whoami) resolves to root. RStudio Server cannot spawn rsession processes for root, causing the jsonrpc error. Hardcode --server-user=rstudio to match the default user in the rocker/rstudio image. --- registry/coder/templates/docker-rstudio/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/registry/coder/templates/docker-rstudio/main.tf b/registry/coder/templates/docker-rstudio/main.tf index 075867c03..de86cda16 100644 --- a/registry/coder/templates/docker-rstudio/main.tf +++ b/registry/coder/templates/docker-rstudio/main.tf @@ -55,13 +55,13 @@ resource "coder_agent" "main" { --server-daemonize=0 \ --auth-none=1 \ --www-port=8787 \ - --server-user=$(whoami) > /tmp/rserver.log 2>&1 & + --server-user=rstudio > /tmp/rserver.log 2>&1 & elif [ -x /usr/lib/rstudio-server/bin/rserver ]; then sudo /usr/lib/rstudio-server/bin/rserver \ --server-daemonize=0 \ --auth-none=1 \ --www-port=8787 \ - --server-user=$(whoami) > /tmp/rserver.log 2>&1 & + --server-user=rstudio > /tmp/rserver.log 2>&1 & fi EOT From 36bd958552fb2b50e687168b03e7eb0d5d2cba52 Mon Sep 17 00:00:00 2001 From: "blink-so[bot]" <211532188+blink-so[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 16:43:35 +0000 Subject: [PATCH 11/11] fix: allow rsession to run as root (auth-minimum-user-id=0) The Coder agent runs as root inside the container. With --auth-none=1, RStudio Server identifies the connecting user as root (uid 0), which is below the default auth-minimum-user-id of 1000. This causes rsession to refuse to launch, resulting in a "jsonrpc error 1 (unable to connect to service)" error in the browser. --- registry/coder/templates/docker-rstudio/build/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registry/coder/templates/docker-rstudio/build/Dockerfile b/registry/coder/templates/docker-rstudio/build/Dockerfile index a87e5738e..a600e748b 100644 --- a/registry/coder/templates/docker-rstudio/build/Dockerfile +++ b/registry/coder/templates/docker-rstudio/build/Dockerfile @@ -8,3 +8,5 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* RUN R -e "install.packages('rmarkdown')" + +RUN echo "auth-minimum-user-id=0" >>/etc/rstudio/rserver.conf