Files
coder/docs/workspaces/workspace-management.md
T
Nick VigilanteandCoder Prototypes e28931cfb1 docs: add how-to for rolling out a security update to every workspace (#31982)
Adds an admin how-to that walks through getting a patched package (for
example an updated `ca-certificates` after a certificate authority is
compromised) into every new and existing workspace. Until now the steps
were spread across image management, template versioning, update
policies, automatic updates, and bulk operations.

The new page
`docs/templates/managing-templates/roll-out-security-updates.md` covers:

1. Rebuilding the image and pinning a new tag or digest, and why a
re-pushed mutable tag can be skipped.
2. Publishing and promoting a template version (dashboard and CLI).
3. Making future starts use the active version: template update policy
(Premium), automatic updates, and autostop requirement (Premium).
4. Updating existing workspaces with a `coder list` | `coder update`
loop (first, because the dashboard handles 25 workspaces per page) or
bulk **Update…**. It warns that bulk **Start** keeps the current version
and that dormant workspaces are skipped.
5. Confirming with the `outdated:true` filter and checking the package
with `coder ssh`.
6. Other places to update, outside the image: dev containers,
`envbuilder` caches, persistent home volumes, and persistent VM disks.
It also covers prebuilt workspaces.

It also adds the page to the sidebar
(`docs/manifest/templates/managing-templates.yml`, regenerated
`docs/manifest.json`) and links to it from `image-management.md` and the
Bulk operations section of `workspace-management.md`. The page links to
existing pages instead of repeating them.

The CLI commands and their output were run against a local dev
deployment: `templates push`, the `coder list --search ...
outdated:true` table, the JSON/`jq`/`xargs coder update -y` loop, the
empty result, and `coder ssh ... -- dpkg-query`. Dashboard steps are
checked against the UI code only.

**Verified against**
- `site/src/pages/WorkspacesPage/WorkspacesPage.tsx`,
`WorkspacesPageView.tsx`, `WorkspacesTable.tsx`,
`BatchUpdateModalForm.tsx`, `batchActions.ts` (Bulk actions labels, bulk
Start uses the current version, bulk Update skips dormant and starts
stopped workspaces, default `user:me` filter)
- `site/src/api/api.ts` (`updateWorkspace`, `changeWorkspaceVersion`,
`startWorkspace`)
- `site/src/pages/TemplatePage/TemplatePageHeader.tsx`,
`TemplateLayout.tsx`, `TemplateVersionsPage/TemplateVersionsPage.tsx`,
`VersionRow.tsx`, `TemplateVersionEditorPage/TemplateVersionEditor.tsx`,
`PublishTemplateVersionDialog.tsx` (Edit files, Build, Publish, Promote
to active version, Promote…)
-
`site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx`,
`Sidebar.tsx` (Operations section, require-active-version label, Premium
badge, Save)
- `site/src/pages/WorkspaceSettingsPage/WorkspaceSettingsForm.tsx`,
`Sidebar.tsx` (Automatic Updates, Update Policy)
- `site/src/modules/workspaces/actions.ts`,
`site/src/utils/workspace.tsx`
- `coderd/database/dbauthz/dbauthz.go` (`InsertWorkspaceBuild`
require-active-version check, exemption for users who can update the
template)
- `enterprise/coderd/coderd.go`,
`enterprise/coderd/dbauthz/accesscontrol.go`, `codersdk/deployment.go`
(`access_control` Premium gating; bulk actions not license-gated)
- `coderd/autobuild/lifecycle_executor.go`, `coderd/workspaces.go`
(autostart uses the active version under the policy or `always`)
- `coderd/rbac/roles.go`, `docs/admin/users/groups-roles.md` (Template
Admin has workspace read only)
- `cli/templatepush.go` (`--activate` default true),
`cli/templateedit.go`, `cli/update.go`, `cli/start.go` (dormant
activation, active-version selection), `cli/list.go`,
`cli/cliui/filter.go` (`--all` ignores `--search`), `cli/ssh.go`
- `coderd/searchquery/search.go` (`outdated` filter)
- `examples/templates/docker/main.tf`,
`examples/templates/kubernetes/main.tf`
- `docs/templates/extending-templates/prebuilt-workspaces.md`,
`docs/admin/integrations/devcontainers/envbuilder/envbuilder-security-caching.md`,
`docs/workspaces/devcontainers/working-with-dev-containers.md`

**Open questions for the reviewer**
- `envbuilder` caching: `envbuilder` isn't in this repo, so I couldn't
confirm that changing the base image reference (for example to a new
digest) always avoids a cached image. The page says to change the
reference and links the upstream caching doc. An `envbuilder` expert
should confirm.
- Docker and Kubernetes pull behavior for re-pushed mutable tags is
described from the vendors' documented defaults and the example
templates. I didn't test it on a real cluster.
- `workspace-management.md` Bulk operations still says "top-right
**Actions** dropdown", but the UI label is **Bulk actions**. I left it
alone to avoid conflicting with #31137, which edits the same section.
Should it be fixed there or here?
- The template update policy has several names: "Template update
policies" in the docs, the UI checkbox "Require workspaces automatically
update when started.", and `--require-active-version`. `index.md` still
tells readers to enable "**Template Update Policies**", which doesn't
match the UI. Not changed here.
- Doc-check suggestion not applied: adding links to the new page from
`change-management.md` and `index.md#update-templates`, which is outside
this change's scope.
- Dashboard steps were checked against the UI code, not run in a
browser.

> Generated by Coder Agents.

Closes DOCS-1354


Supersedes #31810, reopened under a human author for attribution.

---------

Co-authored-by: Coder Prototypes <294797144+coder-prototypes@users.noreply.github.com>
2026-11-24 10:19:42 -05:00

9.6 KiB

title
title
Manage workspaces

A workspace is the environment where a developer or a coding agent works. Developers and agents in a team each work from their own workspace and can use multiple IDEs.

A developer creates a workspace from a shared template. This lets an entire team work in environments that are identically configured and provisioned with the same resources.

Create workspaces

You can create a workspace in the UI. Log in to your Coder instance, go to the Templates tab, find the template you need, and select Create workspace.

Creating a workspace in the UI

When you create a workspace, you will be prompted to give it a name. You might also be prompted to set some parameters that the template provides.

You can manage your existing templates in the Workspaces tab.

You can also create a workspace from the command line:

Each Coder user has their own workspaces created from templates:

# create a workspace from the template; specify any variables
coder create --template="<templateName>" <workspaceName>

# show the resources behind the workspace and how to connect
coder show <workspace-name>

Workspace name rules and restrictions

Constraint Rule
Start/end with Must start and end with a letter or number
Character types Letters, numbers, and hyphens only
Length 1-32 characters
Case sensitivity Case-insensitive (lowercase recommended)
Reserved names Cannot use new or create
Uniqueness Must be unique within your workspaces

Renaming a workspace after you create it is off by default. A template admin can allow it per template. Refer to Workspace renaming.

Workspace filtering

In the Coder UI, you can filter your workspaces using pre-defined filters or Coder's filter query. Filters follow the pattern [filter name]:[filter text] and multiple filters can be specified separated by a space, that is, owner:me status:running

The following filters are supported:

  • owner - Represents the username of the owner. You can also use me as a convenient alias for the logged-in user, for example, owner:me
  • user - Workspaces a user owns, plus workspaces shared with them directly or through a group they belong to. Accepts a username, user ID, or me, for example, user:me
  • name - Name of the workspace.
  • template - Name of the template.
  • status - Indicates the status of the workspace, for example, status:failed For a list of supported statuses, see WorkspaceStatus documentation.
  • outdated - Filters workspaces using an outdated template version, for example, outdated:true
  • dormant - Filters workspaces based on the dormant state, for example, dormant:true
  • has-agent - Only applicable for workspaces in "start" transition. Stopped and deleted workspaces don't have agents. List of supported values connecting|connected|timeout|disconnected, for example, has-agent:connecting
  • id - Workspace universally unique identifier (UUID)
  • healthy - Only applicable for workspaces in "start" transition. healthy:false is an alias for has-agent:timeout,disconnected, healthy:true is an alias for has-agent:connected.
  • include_agent_metadata - Not a filter: expands each agent in the API response with the named agent metadata keys, for example, include_agent_metadata:cpu_usage. Repeat the key to request multiple metadata items. Keys match case-insensitively.

Update workspaces

After updating the default version of the template that a workspace was created from, you can update the workspace.

Updating a workspace

If the workspace is running, Coder stops it, updates it, then starts the workspace again.

Update with the CLI

Update a workspace through the command line:

coder update <workspace-name>

If the workspace is running, coder update asks for confirmation before it stops and updates the workspace. To skip the prompt in scripts and other non-interactive use, add -y:

coder update -y <workspace-name>

By default, coder update stops the workspace with its current template version and starts it on the active version. To start on a specific version instead, use --template-version with the version name or ID. To stop with a different version than the workspace's current one, use --stop-template-version:

coder update <workspace-name> --template-version <version-name>
coder update <workspace-name> --stop-template-version <version-name> --template-version <version-name>

--stop-template-version only applies when coder update stops a started workspace. To stop a workspace with a specific version on its own, use coder stop --template-version.

coder start and coder stop also accept --template-version. Template permissions still apply, so if a template requires the active version, only template admins can start a workspace on another version.

Automatic updates

It can be tedious to manually update a workspace everytime an update is pushed to a template. Users can choose to opt-in to automatic updates to update to the active template version whenever the workspace is started.

Note: If a template is updated such that new parameter inputs are required from the user, autostart will be disabled for the workspace until the user has manually updated the workspace.

Automatic updates

Bulk operations

Admins can apply bulk operations (update, delete, start, stop) in the Workspaces tab. Select the workspaces you'd like to modify with the checkboxes on the left, then use the top-right Actions dropdown to apply the operation.

The start and stop operations can be applied even when the selected workspaces are not all in the same state. Bulk start will only apply to selected workspaces that are currently stopped, and bulk stop will only apply to selected workspaces that are currently running. For update, delete, and stop, the admin applying the operation is prompted for confirmation before any action is taken. The owners of the selected workspaces are not prompted.

Bulk workspace actions

To use bulk update to roll out a patched image to every workspace of a template, refer to Roll out a security update to every workspace.

Start and stop workspaces

By default, you manually start and stop workspaces as you need. You can also schedule a workspace to start and stop automatically.

To set a workspace's schedule, go to the workspace, then Settings > Schedule.

Scheduling UI

Coder might also stop a workspace automatically if there is a template update available.

Learn more about workspace lifecycle and our scheduling features.

Workspace resources

Workspaces in Coder are started and stopped, often based on whether there was any activity or if there was a template update available.

Resources are often destroyed and re-created when a workspace is restarted, though the exact behavior depends on the template. For more information, see Resource Persistence.

Repair workspaces

Use the following command to re-enter template input variables in an existing workspace. This command is useful when a workspace fails to build because its state is out of sync with the template.

coder update <your workspace name> --always-prompt

First, try re-entering parameters from a workspace. In the Coder UI, you can filter your workspaces using pre-defined filters or employing the Coder's filter query. Take a look at the following examples to understand how to use the Coder's filter query:

  • To find the workspaces that you own, use the filter owner:me.
  • To find workspaces that are currently running, use the filter status:running.

Re-entering template variables

You can also do this in the CLI with the following command:

coder update <your workspace name> --always-prompt

If that does not work, a Coder admin can manually push and pull the Terraform state for a given workspace. This can lead to state corruption or deleted resources if you do not know what you are doing.

coder state pull <username>/<workspace name>
# Make changes
coder state push <username>/<workspace name>

Logging

Coder stores macOS and Linux logs at the following locations:

Service Location
startup_script /tmp/coder-startup-script.log
shutdown_script /tmp/coder-shutdown-script.log
Agent /tmp/coder-agent.log

Note

The agent log rotates when it reaches 5 MB in size, and Coder keeps up to 19 rotated files. The startup and shutdown script log files in the workspace have no size limit.