microsoft / microsoft/vscode-remote-release

defaultForwardedPorts differs from User forwarded Ports

Open
#9,715 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug ssh
Dominant language
Dockerfile
Stars
4.2k
Forks
469
Avg merge
1d 1h
Merged PRs (30d)
1

Description

  • VSCode Version: 1.87.2
  • Local OS Version: Mac OS
  • Remote OS Version: Ubuntu 22.04
  • Remote Extension/Connection Type: Containers (on Remote Server)

When using a default forwarded Port, forwards containing a different host don't work.
In my example i got a container inside a docker network next to a minio container and a database container. These are accessible inside my application where i remote into via database:3306 or minio:9000. I now want to automatically forward these ports whenever i connect to the remote container and therefore defined it inside the .vscode/settings.json.

	"remote.SSH.defaultForwardedPorts": [
		{
			"localPort": 3306,
			"name": "Database",
			"remotePort": "database:3306"
		},
		{
			"localPort": 9000,
			"name": "Minio",
			"remotePort": "minio:9000"
		},
		{
			"localPort": 9001,
			"name": "Minio (Web)",
			"remotePort": "minio:9001"
		}
	]

These entries don't work as expected and it fails to connect. However when i now remove the default forwarded ports and manually do the portforwarding through the interface (again using host:port), the services become available and function as it should be.

Steps to Reproduce:

  1. Forward a port using settings.json remote.SSH.defaultForwardedPorts try to connect to container.
  2. Remove said port forwards and do it manually, it works now.

In my opinion, the default ports should work exactly the same as the user forwarded ports.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the remote.SSH.defaultForwardedPorts setting in .vscode/settings.json and compare its host:port handling with ports created through the manual forwarding interface. Reproduce using the database:3306 and minio:9000 examples in a remote container. Done means default forwarded ports with a different host connect and behave like manually forwarded ports.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, vscode
Domain
devtools, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.