Skip to content

Commit 51420b7

Browse files
committed
working-with-dev-containers update with feedback
1 parent 5085d78 commit 51420b7

File tree

1 file changed

+78
-40
lines changed

1 file changed

+78
-40
lines changed

docs/user-guides/devcontainers/working-with-dev-containers.md

Lines changed: 78 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,64 @@ This page assumes you have a template with the [dev containers integration](./in
99

1010
## SSH Access
1111

12-
You can SSH into your dev container directly using the Coder CLI:
12+
You can connect directly to your dev container.
1313

14-
```console
15-
coder ssh --container keen_dijkstra my-workspace
14+
1. Run `coder config-ssh` to configure your SSH local client:
15+
16+
```bash
17+
coder config-ssh
18+
```
19+
20+
1. SSH to your workspace:
21+
22+
```bash
23+
ssh <agent>.<workspace-name>.me.coder
24+
```
25+
26+
Example:
27+
28+
```bash
29+
ssh devcontainer.myworkspace.me.coder
30+
```
31+
32+
### Coder CLI
33+
34+
```bash
35+
coder ssh <workspace-name>
1636
```
1737

18-
> [!NOTE]
19-
>
20-
> SSH access is not yet compatible with the `coder config-ssh` command for use
21-
> with OpenSSH. You would need to manually modify your SSH config to include the
22-
> `--container` flag in the `ProxyCommand`.
38+
Coder CLI connects to your dev container based on your workspace configuration.
2339

24-
## Web Terminal Access
40+
### Web Terminal Access
2541

26-
Once your workspace and dev container are running, you can use the web terminal
27-
in the Coder interface to execute commands directly inside the dev container.
42+
Once your workspace and dev container are running, you can use the **Terminal**
43+
in the Coder workspace to execute commands directly inside the dev container.
2844

2945
![Coder web terminal with dev container](../../images/user-guides/devcontainers/devcontainer-web-terminal.png)
3046

3147
## IDE Integration (VS Code)
3248

33-
You can open your dev container directly in VS Code by:
49+
To open your dev container directly in VS Code, select "Open in VS Code Desktop" from the Coder dashboard.
3450
35-
1. Selecting "Open in VS Code Desktop" from the Coder web interface
36-
2. Using the Coder CLI with the container flag:
51+
Alternatively, you can use the CLI:
3752
38-
```console
39-
coder open vscode --container keen_dijkstra my-workspace
53+
```bash
54+
coder open vscode <workspace-name>
4055
```
4156
42-
While optimized for VS Code, other IDEs with dev containers support may also
43-
work.
57+
Coder CLI connects to your dev container based on your workspace configuration.
4458
4559
## Port Forwarding
4660
47-
During the early access phase, port forwarding is limited to ports defined via
48-
[`appPort`](https://containers.dev/implementors/json_reference/#image-specific)
49-
in your `devcontainer.json` file.
61+
Coder supports port forwarding for dev containers through the following mechanisms:
5062
51-
> [!NOTE]
52-
>
53-
> Support for automatic port forwarding via the `forwardPorts` property in
54-
> `devcontainer.json` is planned for a future release.
63+
1. **Defined Ports**: Ports defined in your `devcontainer.json` file via the [`appPort`](https://containers.dev/implementors/json_reference/#image-specific) property.
64+
65+
1. **Dynamic Ports**: For ports not defined in your `devcontainer.json`, you can use the Coder CLI to forward them:
66+
67+
```bash
68+
coder port-forward <workspace-name> --tcp <local-port>:<container-port>
69+
```
5570
5671
For example, with this `devcontainer.json` configuration:
5772
@@ -61,25 +76,25 @@ For example, with this `devcontainer.json` configuration:
6176
}
6277
```
6378
64-
You can forward these ports to your local machine using:
79+
You can access these ports directly through your browser via the Coder dashboard, or forward them to your local machine:
6580
66-
```console
67-
coder port-forward my-workspace --tcp 8080,4000
81+
```bash
82+
coder port-forward <workspace-name> --tcp 8080,4000
6883
```
6984
70-
This forwards port 8080 (local) -> 8080 (agent) -> 8080 (dev container) and port
71-
4000 (local) -> 4000 (agent) -> 3000 (dev container).
85+
This forwards port 8080 (local) → 8080 (container) and port 4000 (local) → 3000 (container).
7286
7387
## Dev Container Features
7488
75-
You can use standard dev container features in your `devcontainer.json` file.
76-
Coder also maintains a
77-
[repository of features](https://github.com/coder/devcontainer-features) to
78-
enhance your development experience.
89+
Dev container features allow you to enhance your development environment with pre-configured tooling.
90+
91+
Coder supports the standard [dev container features specification](https://containers.dev/implementors/features/), allowing you to use any compatible features in your `devcontainer.json` file.
7992
80-
Currently available features include [code-server](https://github.com/coder/devcontainer-features/blob/main/src/code-server).
93+
### Example: Add code-server
8194
82-
To use the code-server feature, add the following to your `devcontainer.json`:
95+
Coder maintains a [repository of features](https://github.com/coder/devcontainer-features) designed specifically for Coder environments.
96+
97+
To add code-server (VS Code in the browser), add this to your `devcontainer.json`:
8398
8499
```json
85100
{
@@ -93,7 +108,30 @@ To use the code-server feature, add the following to your `devcontainer.json`:
93108
}
94109
```
95110
96-
> [!NOTE]
97-
>
98-
> Remember to include the port in the `appPort` section to ensure proper port
99-
> forwarding.
111+
After rebuilding your container, code-server will be available on the configured port.
112+
113+
### Using Multiple Features
114+
115+
You can combine multiple features in a single `devcontainer.json`:
116+
117+
```json
118+
{
119+
"features": {
120+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
121+
"ghcr.io/devcontainers/features/python:1": {
122+
"version": "3.10"
123+
},
124+
"ghcr.io/coder/devcontainer-features/code-server:1": {
125+
"port": 13337
126+
}
127+
}
128+
}
129+
```
130+
131+
## Rebuilding Dev Containers
132+
133+
When you make changes to your `devcontainer.json` file, you need to rebuild the container for those changes to take effect.
134+
135+
From the Coder dashboard, click the rebuild button on the dev container to apply your changes.
136+
137+
You can also restart your workspace, which will rebuild containers when it restarts.

0 commit comments

Comments
 (0)