2026-09-08 12:34:00 -04:00
---
title : Work with Dev Containers
---
2025-05-02 01:45:02 +03:00
2026-10-14 14:04:33 -04:00
The dev container integration appears in your Coder dashboard, providing a visual representation of the running environment:
2025-05-02 01:45:02 +03:00
2025-12-09 20:08:58 +02:00
_Dev containers appear as sub-agents with their own apps, SSH access, and port forwarding_
2025-05-02 01:45:02 +03:00
2025-12-05 19:42:16 +02:00
## SSH access
2025-05-02 01:45:02 +03:00
2026-10-23 22:27:18 -07:00
Each dev container has its own agent name, derived from the workspace folder (for example, `/home/coder/my-project` becomes `my-project` ).
2026-10-14 14:04:33 -04:00
You can find agent names in your workspace dashboard, or see [Agent naming ](./index.md#agent-naming ) for details on how names are generated.
2025-12-05 19:42:16 +02:00
2026-09-28 13:40:07 -04:00
<a id="using-the-coder-cli"></a>
### Use the Coder CLI
2025-12-05 19:42:16 +02:00
2026-10-14 14:04:33 -04:00
The simplest way to SSH into a dev container is using `coder ssh` with the workspace and agent name:
2025-05-02 01:45:02 +03:00
```console
2025-12-05 19:42:16 +02:00
coder ssh <workspace>.<agent>
2025-05-02 01:45:02 +03:00
```
2026-10-14 14:04:33 -04:00
For example, to connect to a dev container with agent name `my-project` in workspace `my-workspace` :
2025-05-02 01:45:02 +03:00
2025-12-05 19:42:16 +02:00
```console
coder ssh my-workspace.my-project
```
To SSH into the main workspace agent instead of the dev container:
```console
coder ssh my-workspace
```
2026-09-28 13:40:07 -04:00
<a id="using-openssh-config-ssh"></a>
### Use OpenSSH (config-ssh)
2025-12-05 19:42:16 +02:00
2026-10-14 14:04:33 -04:00
You can also use standard OpenSSH tools after generating SSH config entries with `coder config-ssh` :
2025-12-05 19:42:16 +02:00
```console
coder config-ssh
```
2026-10-14 14:04:33 -04:00
This creates a wildcard SSH host entry that matches all your workspaces and their agents, including dev container sub-agents.
You can then connect using:
2025-12-05 19:42:16 +02:00
```console
ssh my-project.my-workspace.me.coder
```
2026-10-14 14:04:33 -04:00
The default hostname suffix is `.coder` .
If your organization uses a different suffix, adjust the hostname accordingly.
The suffix can be configured via [`coder config-ssh --hostname-suffix` ](../../reference/cli/config-ssh.md ) or by your deployment administrator.
2025-12-05 19:42:16 +02:00
2026-10-14 14:04:33 -04:00
This method works with any SSH client, IDE remote extensions, `rsync` , `scp` , and other tools that use SSH.
2025-12-05 19:42:16 +02:00
## Web terminal access
2025-05-02 01:45:02 +03:00
2026-10-14 14:04:33 -04:00
Once your workspace and dev container are running, you can use the web terminal in the Coder interface to execute commands directly inside the dev container.
2025-05-02 01:45:02 +03:00

2025-12-05 19:42:16 +02:00
## IDE integration (VS Code)
2025-05-02 01:45:02 +03:00
You can open your dev container directly in VS Code by:
2026-10-14 14:04:33 -04:00
1. Selecting **Open in VS Code Desktop** from the dev container agent in the Coder web interface.
2025-12-05 19:42:16 +02:00
1. Using the Coder CLI:
2025-05-02 01:45:02 +03:00
2025-12-05 19:42:16 +02:00
```console
coder open vscode <workspace>.<agent>
` ``
2025-05-02 01:45:02 +03:00
2025-12-05 19:42:16 +02:00
For example:
` ``console
coder open vscode my-workspace.my-project
` ``
2026-10-14 14:04:33 -04:00
VS Code will automatically detect the dev container environment and connect appropriately.
2025-12-05 19:42:16 +02:00
2026-11-06 17:17:35 -05:00
While optimized for VS Code, other IDEs with dev container support might also work.
2025-05-02 01:45:02 +03:00
2025-12-05 19:42:16 +02:00
## Port forwarding
2025-05-02 01:45:02 +03:00
2026-10-14 14:04:33 -04:00
Since dev containers run as sub-agents, you can forward ports directly to them using standard Coder port forwarding:
2025-12-05 19:42:16 +02:00
` ``console
coder port-forward <workspace>.<agent> --tcp 8080
` ``
2026-10-14 14:04:33 -04:00
For example, to forward port 8080 from a dev container with agent name ` my-project`:
2025-12-05 19:42:16 +02:00
` ``console
coder port-forward my-workspace.my-project --tcp 8080
` ``
2026-10-14 14:04:33 -04:00
This forwards port 8080 on your local machine directly to port 8080 in the dev container.
Coder also automatically detects ports opened inside the container.
2025-12-05 19:42:16 +02:00
2026-09-28 13:40:07 -04:00
<a id="exposing-ports-on-the-parent-workspace"></a>
### Expose ports on the parent workspace
2025-12-05 19:42:16 +02:00
2026-10-14 14:04:33 -04:00
If you need to expose dev container ports through the parent workspace agent (rather than the sub-agent), you can use the [` appPort`](https://containers.dev/implementors/json_reference/#image-specific) property in your ` devcontainer.json`:
2025-05-02 01:45:02 +03:00
` ``json
{
2025-12-05 19:42:16 +02:00
"appPort": ["8080:8080", "4000:3000"]
2025-05-02 01:45:02 +03:00
}
` ``
2026-10-14 14:04:33 -04:00
This maps container ports to the parent workspace, which can then be forwarded using the main workspace agent.
2025-05-02 01:45:02 +03:00
2025-12-05 19:42:16 +02:00
## Dev container features
2025-05-02 01:45:02 +03:00
2026-10-14 14:04:33 -04:00
You can use standard [dev container features](https://containers.dev/features) in your ` devcontainer.json` file.
Coder also maintains a [repository of features](https://github.com/coder/devcontainer-features) to enhance your development experience.
2025-05-02 01:45:02 +03:00
2026-10-14 14:04:33 -04:00
For example, the [code-server](https://github.com/coder/devcontainer-features/blob/main/src/code-server) feature from the [Coder features repository](https://github.com/coder/devcontainer-features):
2025-05-02 01:45:02 +03:00
` ``json
{
2025-12-05 19:42:16 +02:00
"features": {
"ghcr.io/coder/devcontainer-features/code-server:1": {
"port": 13337,
"host": "0.0.0.0"
}
}
2025-05-02 01:45:02 +03:00
}
` ``
2026-09-28 13:40:07 -04:00
<a id="rebuilding-dev-containers"></a>
## Rebuild dev containers
2025-12-05 19:42:16 +02:00
2026-10-14 14:04:33 -04:00
When you modify your ` devcontainer.json`, you need to rebuild the container for changes to take effect.
Coder detects changes and shows an **Outdated** status next to the dev container.
2025-12-05 19:42:16 +02:00
2025-12-09 20:08:58 +02:00
_The Outdated indicator appears when changes to devcontainer.json are detected_
2026-08-27 12:24:06 -04:00
Select **Rebuild** to recreate your dev container with the updated configuration.