Write a Coder template from scratch with coder_agent and code-server
At a glance
Coder’s tutorial walks you through a Docker+Ubuntu workspace template in Terraform: coder_agent, code-server via coder_app, persistent home volume, then push with the CLI or dashboard. This workflow is listed under sponsor, devtools, templates, terraform, cde.
- Agents / tools
- Coder, Terraform, Docker, code-server
Building a tool for these workflows? See weekly rates.
What they did
Create a template directory with a Dockerfile (Ubuntu + sudo/curl + coder user) and main.tf that wires coder/docker providers, a coder_agent (startup installs code-server, sets git author env, CPU/RAM metadata), coder_app for the browser IDE, a persistent docker_volume for home, and an ephemeral docker_container gated by start_count. Then coder login and coder templates push (or zip-upload in the dashboard) and create a workspace from the new template.
Worth knowing
Needs Docker and Coder already installed. Docs tip: use the visual template builder if you do not want to write Terraform. The agent needs curl access to the control plane; remote compute needs agent auth credentials. Prefer immutable workspace id for volume names so renames do not destroy home data.