Skip to content

Commit 61beb7b

Browse files
authored
docs: rewrite dev containers documentation for GA (#21080)
docs: rewrite dev containers documentation for GA Corrects inaccuracies in SSH examples (deprecated `--container` flag), port forwarding (native sub-agent forwarding is primary), and prerequisites (dev containers are on by default). Fixes template descriptions: docker-devcontainer uses native Dev Containers while AWS/Kubernetes templates use Envbuilder. Renames admin docs folder from `devcontainers/` to `envbuilder/` to reflect actual content. Adds customization guide documenting agent naming, display apps, custom apps, and variable interpolation. Documents multi-repo workspace support and adds note about Terraform module limitations with sub-agents. Fixes module registry URLs. Refs #18907
1 parent b4be5bc commit 61beb7b

File tree

18 files changed

+761
-236
lines changed

18 files changed

+761
-236
lines changed

.markdownlint-cli2.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignores": ["PLAN.md"],
3+
}

docs/_redirects

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@
44
# Redirect old offline anchor fragments to new airgap anchors
55
/install/offline#offline-docs /install/airgap#airgap-docs 301
66
/install/offline#offline-container-images /install/airgap#airgap-container-images 301
7+
8+
# Redirect old devcontainers folder to envbuilder
9+
/admin/templates/managing-templates/devcontainers /admin/templates/managing-templates/envbuilder 301
10+
/admin/templates/managing-templates/devcontainers/index /admin/templates/managing-templates/envbuilder 301
11+
/admin/templates/managing-templates/devcontainers/add-devcontainer /admin/templates/managing-templates/envbuilder/add-envbuilder 301
12+
/admin/templates/managing-templates/devcontainers/devcontainer-security-caching /admin/templates/managing-templates/envbuilder/envbuilder-security-caching 301
13+
/admin/templates/managing-templates/devcontainers/devcontainer-releases-known-issues /admin/templates/managing-templates/envbuilder/envbuilder-releases-known-issues 301

docs/about/contributing/templates.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ resource "kubernetes_pod" "workspace" {
510510
## Get help
511511

512512
- **Examples**: Review real-world examples from the [official Coder templates](https://registry.coder.com/contributors/coder?tab=templates):
513-
- [AWS EC2 (Devcontainer)](https://registry.coder.com/templates/aws-devcontainer) - AWS EC2 VMs with devcontainer support
514-
- [Docker (Devcontainer)](https://registry.coder.com/templates/docker-devcontainer) - Envbuilder containers with dev container support
515-
- [Kubernetes (Devcontainer)](https://registry.coder.com/templates/kubernetes-devcontainer) - Envbuilder pods on Kubernetes
513+
- [AWS EC2 (Devcontainer)](https://registry.coder.com/templates/aws-devcontainer) - AWS EC2 VMs with Envbuilder
514+
- [Docker (Devcontainer)](https://registry.coder.com/templates/docker-devcontainer) - Docker-in-Docker with Dev Containers integration
515+
- [Kubernetes (Devcontainer)](https://registry.coder.com/templates/kubernetes-devcontainer) - Kubernetes pods with Envbuilder
516516
- [Docker Containers](https://registry.coder.com/templates/docker) - Basic Docker container workspaces
517517
- [AWS EC2 (Linux)](https://registry.coder.com/templates/aws-linux) - AWS EC2 VMs for Linux development
518518
- [Google Compute Engine (Linux)](https://registry.coder.com/templates/gcp-vm-container) - GCP VM instances

docs/admin/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ For any information not strictly contained in these sections, check out our
5252
### Development containers (dev containers)
5353

5454
- A
55-
[Development Container](./templates/managing-templates/devcontainers/index.md)
55+
[Development Container](./templates/extending-templates/devcontainers.md)
5656
is an open-source specification for defining development environments (called
5757
dev containers). It is generally stored in VCS alongside associated source
5858
code. It can reference an existing base image, or a custom Dockerfile that

docs/admin/templates/extending-templates/devcontainers.md

Lines changed: 57 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ This is the recommended approach for most use cases.
2525

2626
### Project Discovery
2727

28-
Enable automatic discovery of Dev Containers in Git repositories. Project discovery automatically scans Git repositories for `.devcontainer/devcontainer.json` or `.devcontainer.json` files and surfaces them in the Coder UI. See the [Environment Variables](#environment-variables) section for detailed configuration options.
28+
Alternatively, enable automatic discovery of Dev Containers in Git repositories.
29+
The agent scans for `devcontainer.json` files and surfaces them in the Coder UI.
30+
See [Environment Variables](#environment-variables) for configuration options.
2931

3032
## Install the Dev Containers CLI
3133

@@ -36,7 +38,7 @@ to ensure the `@devcontainers/cli` is installed in your workspace:
3638
```terraform
3739
module "devcontainers-cli" {
3840
count = data.coder_workspace.me.start_count
39-
source = "dev.registry.coder.com/modules/devcontainers-cli/coder"
41+
source = "registry.coder.com/coder/devcontainers-cli/coder"
4042
agent_id = coder_agent.dev.id
4143
}
4244
```
@@ -72,6 +74,10 @@ resource "coder_devcontainer" "my-repository" {
7274
> module to ensure your repository is cloned into the workspace folder and ready
7375
> for automatic startup.
7476
77+
For multi-repo workspaces, define multiple `coder_devcontainer` resources, each
78+
pointing to a different repository. Each one runs as a separate sub-agent with
79+
its own terminal and apps in the dashboard.
80+
7581
## Enable Dev Containers Integration
7682

7783
Dev Containers integration is **enabled by default** in Coder 2.24.0 and later.
@@ -119,15 +125,17 @@ by setting this to `false`.
119125

120126
Enables automatic discovery of Dev Containers in Git repositories.
121127

122-
When enabled, the agent will:
128+
When enabled, the agent scans the configured working directory (set via the
129+
`directory` attribute in `coder_agent`, typically the user's home directory) for
130+
Git repositories. If the directory itself is a Git repository, it searches that
131+
project. Otherwise, it searches immediate subdirectories for Git repositories.
123132

124-
- Scan the agent directory for Git repositories
125-
- Look for `.devcontainer/devcontainer.json` or `.devcontainer.json` files
126-
- Surface discovered Dev Containers automatically in the Coder UI
127-
- Respect `.gitignore` patterns during discovery
133+
For each repository found, the agent looks for `devcontainer.json` files in the
134+
[standard locations](../../../user-guides/devcontainers/index.md#add-a-devcontainerjson)
135+
and surfaces discovered Dev Containers in the Coder UI. Discovery respects
136+
`.gitignore` patterns.
128137

129-
You can disable automatic discovery by setting this to `false` if you prefer to
130-
use only the `coder_devcontainer` resource for explicit configuration.
138+
Set to `false` if you prefer explicit configuration via `coder_devcontainer`.
131139

132140
### CODER_AGENT_DEVCONTAINERS_DISCOVERY_AUTOSTART_ENABLE
133141

@@ -142,67 +150,33 @@ always auto-start regardless of this setting.
142150

143151
## Per-Container Customizations
144152

145-
Individual Dev Containers can be customized using the `customizations.coder` block
146-
in your `devcontainer.json` file. These customizations allow you to control
147-
container-specific behavior without modifying your template.
148-
149-
### Ignore Specific Containers
150-
151-
Use the `ignore` option to hide a Dev Container from Coder completely:
152-
153-
```json
154-
{
155-
"name": "My Dev Container",
156-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
157-
"customizations": {
158-
"coder": {
159-
"ignore": true
160-
}
161-
}
162-
}
163-
```
164-
165-
When `ignore` is set to `true`:
166-
167-
- The Dev Container won't appear in the Coder UI
168-
- Coder won't manage or monitor the container
169-
170-
This is useful when you have Dev Containers in your repository that you don't
171-
want Coder to manage.
172-
173-
### Per-Container Auto-Start
174-
175-
Control whether individual Dev Containers should auto-start using the
176-
`autoStart` option:
177-
178-
```json
179-
{
180-
"name": "My Dev Container",
181-
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
182-
"customizations": {
183-
"coder": {
184-
"autoStart": true
185-
}
186-
}
187-
}
188-
```
189-
190-
**Important**: The `autoStart` option only applies when global auto-start is
191-
enabled via `CODER_AGENT_DEVCONTAINERS_DISCOVERY_AUTOSTART_ENABLE=true`. If
192-
the global setting is disabled, containers won't auto-start regardless of this
193-
setting.
194-
195-
When `autoStart` is set to `true`:
153+
> [!NOTE]
154+
>
155+
> Dev container sub-agents are created dynamically after workspace provisioning,
156+
> so Terraform resources like
157+
> [`coder_script`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/script)
158+
> and [`coder_app`](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/app)
159+
> cannot currently be attached to them. Modules from the
160+
> [Coder registry](https://registry.coder.com) that depend on these resources
161+
> are also not currently supported for sub-agents.
162+
>
163+
> To add tools to dev containers, use
164+
> [dev container features](../../../user-guides/devcontainers/working-with-dev-containers.md#dev-container-features).
165+
> For Coder-specific apps, use the
166+
> [`apps` customization](../../../user-guides/devcontainers/customizing-dev-containers.md#custom-apps).
196167
197-
- The Dev Container automatically builds and starts during workspace
198-
initialization
199-
- Works on a per-container basis (you can enable it for some containers but not
200-
others)
168+
Developers can customize individual dev containers using the `customizations.coder`
169+
block in their `devcontainer.json` file. Available options include:
201170

202-
When `autoStart` is set to `false` or omitted:
171+
- `ignore` — Hide a dev container from Coder completely
172+
- `autoStart` — Control whether the container starts automatically (requires
173+
`CODER_AGENT_DEVCONTAINERS_DISCOVERY_AUTOSTART_ENABLE` to be enabled)
174+
- `name` — Set a custom agent name
175+
- `displayApps` — Control which built-in apps appear
176+
- `apps` — Define custom applications
203177

204-
- The Dev Container is discovered and shown in the UI
205-
- Users must manually start it via the UI
178+
For the full reference, see
179+
[Customizing dev containers](../../../user-guides/devcontainers/customizing-dev-containers.md).
206180

207181
## Complete Template Example
208182

@@ -232,7 +206,7 @@ resource "coder_agent" "dev" {
232206
233207
module "devcontainers-cli" {
234208
count = data.coder_workspace.me.start_count
235-
source = "dev.registry.coder.com/modules/devcontainers-cli/coder"
209+
source = "registry.coder.com/coder/devcontainers-cli/coder"
236210
agent_id = coder_agent.dev.id
237211
}
238212
@@ -243,9 +217,10 @@ resource "coder_devcontainer" "my-repository" {
243217
}
244218
```
245219

246-
### Alternative: Project Discovery Mode
220+
### Alternative: Project Discovery with Autostart
247221

248-
You can enable automatic starting of discovered Dev Containers:
222+
By default, discovered containers appear in the dashboard but developers must
223+
manually start them. To have them start automatically, enable autostart:
249224

250225
```terraform
251226
resource "docker_container" "workspace" {
@@ -261,20 +236,28 @@ resource "docker_container" "workspace" {
261236
}
262237
```
263238

264-
With this configuration:
239+
With autostart enabled:
265240

266-
- Project discovery is enabled (default behavior)
267-
- Discovered containers are automatically started (via the env var)
268-
- The `coder_devcontainer` resource is **not** required
241+
- Discovered containers automatically build and start during workspace
242+
initialization
243+
- The `coder_devcontainer` resource is not required
269244
- Developers can work with multiple projects seamlessly
270245

271246
> [!NOTE]
272247
>
273248
> When using project discovery, you still need to install the devcontainers CLI
274249
> using the module or in your base image.
275250
251+
## Example Template
252+
253+
The [Docker (Dev Containers)](https://github.com/coder/coder/tree/main/examples/templates/docker-devcontainer)
254+
starter template demonstrates Dev Containers integration using Docker-in-Docker.
255+
It includes the `devcontainers-cli` module, `git-clone` module, and the
256+
`coder_devcontainer` resource.
257+
276258
## Next Steps
277259

278260
- [Dev Containers Integration](../../../user-guides/devcontainers/index.md)
261+
- [Customizing Dev Containers](../../../user-guides/devcontainers/customizing-dev-containers.md)
279262
- [Working with Dev Containers](../../../user-guides/devcontainers/working-with-dev-containers.md)
280263
- [Troubleshooting Dev Containers](../../../user-guides/devcontainers/troubleshooting-dev-containers.md)

docs/admin/templates/index.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ needs of different teams.
4848

4949
- [Image management](./managing-templates/image-management.md): Learn how to
5050
create and publish images for use within Coder workspaces & templates.
51-
- [Dev Container support](./managing-templates/devcontainers/index.md): Enable
52-
dev containers to allow teams to bring their own tools into Coder workspaces.
53-
- [Early Access Dev Containers](../../user-guides/devcontainers/index.md): Try our
54-
new direct devcontainers integration (distinct from Envbuilder-based
55-
approach).
51+
- [Dev Containers integration](./extending-templates/devcontainers.md): Enable
52+
native dev containers support using `@devcontainers/cli` and Docker.
53+
- [Envbuilder](./managing-templates/envbuilder/index.md): Alternative approach
54+
for environments without Docker access.
5655
- [Template hardening](./extending-templates/resource-persistence.md#-bulletproofing):
5756
Configure your template to prevent certain resources from being destroyed
5857
(e.g. user disks).

docs/admin/templates/managing-templates/devcontainers/add-devcontainer.md renamed to docs/admin/templates/managing-templates/envbuilder/add-envbuilder.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# Add a dev container template to Coder
1+
# Add an Envbuilder template
22

3-
A Coder administrator adds a dev container-compatible template to Coder
4-
(Envbuilder). This allows the template to prompt for the developer for their dev
5-
container repository's URL as a
6-
[parameter](../../extending-templates/parameters.md) when they create their
7-
workspace. Envbuilder clones the repo and builds a container from the
3+
A Coder administrator adds an Envbuilder-compatible template to Coder. This
4+
allows the template to prompt the developer for their dev container repository's
5+
URL as a [parameter](../../extending-templates/parameters.md) when they create
6+
their workspace. Envbuilder clones the repo and builds a container from the
87
`devcontainer.json` specified in the repo.
98

109
You can create template files through the Coder dashboard, CLI, or you can
@@ -143,4 +142,4 @@ Lifecycle scripts are managed by project developers.
143142

144143
## Next steps
145144

146-
- [Dev container security and caching](./devcontainer-security-caching.md)
145+
- [Envbuilder security and caching](./envbuilder-security-caching.md)

docs/admin/templates/managing-templates/devcontainers/devcontainer-releases-known-issues.md renamed to docs/admin/templates/managing-templates/envbuilder/envbuilder-releases-known-issues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Dev container releases and known issues
1+
# Envbuilder releases and known issues
22

33
## Release channels
44

docs/admin/templates/managing-templates/devcontainers/devcontainer-security-caching.md renamed to docs/admin/templates/managing-templates/envbuilder/envbuilder-security-caching.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Dev container security and caching
1+
# Envbuilder security and caching
22

33
Ensure Envbuilder can only pull pre-approved images and artifacts by configuring
44
it with your existing HTTP proxies, firewalls, and artifact managers.
@@ -26,7 +26,7 @@ of caching:
2626

2727
- Caches the entire image, skipping the build process completely (except for
2828
post-build
29-
[lifecycle scripts](./add-devcontainer.md#dev-container-lifecycle-scripts)).
29+
[lifecycle scripts](./add-envbuilder.md#dev-container-lifecycle-scripts)).
3030

3131
Note that caching requires push access to a registry, and may require approval
3232
from relevant infrastructure team(s).
@@ -62,5 +62,5 @@ You may also wish to consult a
6262

6363
## Next steps
6464

65-
- [Dev container releases and known issues](./devcontainer-releases-known-issues.md)
65+
- [Envbuilder releases and known issues](./envbuilder-releases-known-issues.md)
6666
- [Dotfiles](../../../../user-guides/workspace-dotfiles.md)

docs/admin/templates/managing-templates/devcontainers/index.md renamed to docs/admin/templates/managing-templates/envbuilder/index.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
# Dev containers
2-
3-
A Development Container is an
4-
[open-source specification](https://containers.dev/implementors/spec/) for
5-
defining containerized development environments which are also called
6-
development containers (dev containers).
1+
# Envbuilder
2+
3+
Envbuilder is an open-source tool that builds development environments from
4+
[dev container](https://containers.dev/implementors/spec/) configuration files.
5+
Unlike the [native Dev Containers integration](../../extending-templates/devcontainers.md),
6+
Envbuilder transforms the workspace image itself rather than running containers
7+
inside the workspace.
8+
9+
> [!NOTE]
10+
>
11+
> For most use cases, we recommend the
12+
> [native Dev Containers integration](../../extending-templates/devcontainers.md),
13+
> which uses the standard `@devcontainers/cli` and Docker. Envbuilder is an
14+
> alternative for environments where Docker is not available or for
15+
> administrator-controlled dev container workflows.
716
817
Dev containers provide developers with increased autonomy and control over their
918
Coder cloud development environments.
@@ -119,4 +128,4 @@ of the Coder control plane and even run within a CI/CD pipeline.
119128

120129
## Next steps
121130

122-
- [Add a dev container template](./add-devcontainer.md)
131+
- [Add an Envbuilder template](./add-envbuilder.md)

0 commit comments

Comments
 (0)