8000 detect new container port listeners, automatically forward from host · Issue #47 · boldsoftware/sketch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

detect new container port listeners, automatically forward from host #47

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

Open
banksean opened this issue May 2, 2025 · 0 comments
Open

Comments

@banksean
Copy link
Contributor
banksean commented May 2, 2025

rough outline:

  • innie process runs "netstat -lntu" in a polling loop to monitor port listeners inside the container
  • if a new port listener appears (or old one disappears), innie posts a message to outie with the port number (maybe some other info?)
  • when outie gets a "/port-listner-changed" event from innie, it shells out to "ssh -L hostPort:127.0.0.1:containerPort" to start tunneling over ssh, and updates the UI to let the user know about the newly tunneled port.

At least one gotcha to consider: we might not always (or even usually?) be able to make hostPort == containerPort

  • e.g.: app inside container starts with -p 8080 so it prints out "visit http://localhost:8080" to the terminal
  • innie netstat poller picks up the new listener on 8080, POSTs to outie about it
  • outie gets the new-port-listener msg, however: 8080 is already taken on host by some other process
  • outie assigns a different port than the one requested by the innie, say 8081: "ssh -L 8081:127.0.0.1:8080"
  • ...confusion ensues when you click on the "visit http://localhost:8080" message from the container and do not get the app that printed that message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0