devpod icon indicating copy to clipboard operation
devpod copied to clipboard

Question: why is localhost access only available when connected via ssh

Open gotcha opened this issue 1 year ago • 3 comments

I am running my devpod container with ide none and provider docker. I have the following in .devcontainer.json:

"forwardPorts": [8080],

If I am connected to the container via ssh mypod.devpod, I can access http://localhost:8080 from my browser. If I am not connected, the browser cannot connect to localhost:8080. Am I missing sthing ?

If it is normal, what is the reason ?

gotcha avatar Sep 05 '24 15:09 gotcha

Hey @gotcha,

DevPod needs a connection to your workspace to forward the remote port to your local machine. Usually that's done when you're connecting your IDE, or ssh into the workspace. We could think about adding a background mode where we'd start a long-lasting connection in the background and keep the ports forwarded. We'll need to think that through though as it's very likely to cause port clashes

pascalbreuninger avatar Sep 05 '24 16:09 pascalbreuninger

@pascalbreuninger

Are you implying that ssh-ing into the container also tunnels the forwarded ports ?

If this is the case, the only need in my opinion is to somehow document this "implementation detail" (which it is not) to avoid any misunderstanding, especially by newbies that might not have any idea about tunneling.

gotcha avatar Sep 09 '24 07:09 gotcha

Are you implying that ssh-ing into the container also tunnels the forwarded ports ?

Pretty much, yep. Thanks for the feedback, we'll update the docs

pascalbreuninger avatar Sep 09 '24 18:09 pascalbreuninger