microsoft / microsoft/vscode-containers

Have 'Open in Browser' check sensible defaults before complaining 'No valid ports are available'

Open
#218 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
139
Forks
87
Avg merge
9h 15m
Merged PRs (30d)
9

Description

Is your feature request related to a problem? Please describe.

Sometimes desiring isolation makes us prefer not mapping ports to the container host.
Currently, when I right-click a container in the VS Code ContainerTools (ms-azuretools.vscode-containers ver 2.1.0) and select "Open in Browser", a notification appears saying ''No valid ports are available'. The container runs a website without any port mappings.

Describe the solution you'd like

I'd like the extension to check sensible defaults before complaining that no valid ports are available. Specifically:
Is the container listening on port 443?
Yes = point the browser to HTTPS://<container's IP>
No =
Is the container listening on port 80?
Yes = point the browser to HTTP://<container's IP>
No = Now you can complain 'No valid ports are available'.

Describe alternatives you've considered

This is what I do now: bookmark the site in my browser so I can manually launch my browser and manually select the bookmark.

Alternatively, Feature #148, prompting for a port and remembering it for that container would also suffice nicely.

Thank you for considering this feature request!

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 by locating the TypeScript implementation of the "Open in Browser" command and inspect how it discovers container ports and addresses. Done means containers without mapped ports open over HTTPS on port 443 or HTTP on port 80 when available, while other containers still show "No valid ports are available".

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, typescript, vscode
Domain
desktop, devtools
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.