Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A way to enumerate/inspect port forwarding from within the dev container. #10658

Closed
modulozero opened this issue Jan 23, 2025 · 2 comments
Closed
Assignees
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster

Comments

@modulozero
Copy link

I'd like a method to find out what the host-side of port forwarding looks like, from within the container. Even a JSON dump of [host_side_port,remote_side_host:remote_side_port] would be pretty great. As far as I can tell, short of developing an extension from scratch, there's no way to do it, at least short of exposing the docker socket to the inside of the container (awkward, as I'm already running docker-inside-docker).

The use case is as follows:

  • I set up a dev container that is supposed to work with the "clone repository in a container" feature.
  • I set up port forwarding.
  • I do not force specific localhost ports
    Perhaps I want to be able to run several instances of the container in parallel, or to not worry that the user's host will happen to have something on the same port.
  • The application wants to generate absolute links at certain times.
  • I want to be able to:
    • Print a message like "Reach the front-end at https://localhost:port".
    • The absolute links generated in the application to work correctly.

I generally have a method to programmatically alter the host:port part of the absolute links, but for that to work, I need to know what the port will be on the outside.

@vs-code-engineering vs-code-engineering bot added the containers Issue in vscode-remote containers label Jan 23, 2025
@chrmarti
Copy link
Contributor

If you print the message in a terminal, the port will be rewritten before opening when the user clicks on it. Also the openExternal extension API rewrites the port.

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Jan 24, 2025
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants