devcontainers / devcontainers/cli

forwardPorts configuration option not working

Open
#186 10 comments 22 reactions 0 assignees View on GitHub
feature-request
Dominant language
TypeScript
Stars
3k
Forks
457
Avg merge
13h 17m
Merged PRs (30d)
6

Description

With the recent release (the one with features) I tried experimenting with the devcontainers CLI. But I just can't get the `forwardPorts` feature to work. I created the following minimal `devcontainer.json` file:
```
{
"name": "my-project-devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
}
},
"forwardPorts": [2222],
"remoteUser": "vscode"
}
```

Maybe I am misunderstanding the `forwardPorts` option, but I would expect that this configuration will forward the port 2222 (this is the default defined by the sshd feature) from the devcontainer to my host. But a simple `ssh localhost -p 2222` did not work.

I tried this on Windows 11.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.