You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remote Explorer shows container published ports as "forwarded", which is misleading #1809
Currently the Remote Explorer is not distinguishing between "published" and "forwarded" ports for a container.
Using "appPort" publishes a port rather than forwarding it. A key difference is that an application needs to listen on all interfaces (0.0.0.0 or "*") rather than localhost for it to be accessbile internally.
The "Forward" command actually does real port forwarding. In this case, "localhost:" is actually forwarded to localhost on the other side. This means that applications could listen on localhost only.
Both of these show up as follows in the UI:
Recently I've seen confusion about this particularly in the case of Python flask applications that listen on localhost by default (while Express.js in node would listen on all interfaces typically).
Short term, we should make sure that this distinction is visible any location where we show ports configured via "appPort".
(We also likely should evaluate whether we should include a "forwardPorts" property that actually does forward ports to alleviate confusion here - this property already exists in the attached config.)
Chuck Lantz (@Chuxel) It seems like when a user adds a port to appPort what they want is for that port to be available to them locally for developing/testing their application. With this goal in mind, might it make more sense to align the behavior of appPort with forwarding a port?
That the appPort isn't really forwarded is confusing, and the fact that it's done with docker publishing the port seems like an implementation detail. Instead of surfacing a confusing implementation detail (publish vs. forward) we could remove the confusion and simplify the UI by just having forwarded ports that all behave the same way.
That said, even if we did that, anything started by Docker Compose or the user themselves would also publish rather than forward, so if those ports appeared, I think we'd still want to make that difference clear.
I agree, we can't make published ports disappear, they are part of the basic functionality of Docker.
I'd prefer to leave appPort as it is (can be an array, string or number and is only available for single containers) and add forwardPorts similar to the attach config for all variants of the devcontainer.json.
Activity
alexr00 commentedon Nov 22, 2019
Chuck Lantz (@Chuxel) It seems like when a user adds a port to
appPortwhat they want is for that port to be available to them locally for developing/testing their application. With this goal in mind, might it make more sense to align the behavior ofappPortwith forwarding a port?That the
appPortisn't really forwarded is confusing, and the fact that it's done with docker publishing the port seems like an implementation detail. Instead of surfacing a confusing implementation detail (publish vs. forward) we could remove the confusion and simplify the UI by just having forwarded ports that all behave the same way.Chuxel commentedon Nov 22, 2019
Alex Ross (@alexr00) Personally, I'd be okay with that. Christof Marti (@chrmarti) ?
That said, even if we did that, anything started by Docker Compose or the user themselves would also publish rather than forward, so if those ports appeared, I think we'd still want to make that difference clear.
chrmarti commentedon Nov 22, 2019
I agree, we can't make published ports disappear, they are part of the basic functionality of Docker.
I'd prefer to leave
appPortas it is (can be an array, string or number and is only available for single containers) and addforwardPortssimilar to the attach config for all variants of the devcontainer.json.Chuxel commentedon Nov 22, 2019
Christof Marti (@chrmarti) Good point -
forwardPortswould also mesh with what is in the attach config.egamma commentedon Feb 5, 2020
Fixed in the common forwarded view.