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

Remote Explorer shows container published ports as "forwarded", which is misleading #1809

Closed
Chuxel opened this issue Nov 7, 2019 · 5 comments
Assignees
Labels
containers Issue in vscode-remote containers

Comments

@Chuxel
Copy link
Member

Chuxel commented Nov 7, 2019

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:

image

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.)

//cc: @chrmarti @alexr00

@Chuxel Chuxel added the containers Issue in vscode-remote containers label Nov 8, 2019
@alexr00
Copy link
Member

alexr00 commented Nov 22, 2019

@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.

@Chuxel
Copy link
Member Author

Chuxel commented Nov 22, 2019

@alexr00 Personally, I'd be okay with that. @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
Copy link
Contributor

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.

@Chuxel
Copy link
Member Author

Chuxel commented Nov 22, 2019

@chrmarti Good point - forwardPorts would also mesh with what is in the attach config.

@egamma
Copy link
Member

egamma commented Feb 5, 2020

Fixed in the common forwarded view.

@egamma egamma closed this as completed Feb 5, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
containers Issue in vscode-remote containers
Projects
None yet
Development

No branches or pull requests

4 participants