Skip to content

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

Closed

Description

@Chuxel

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: Christof Marti (@chrmarti) Alex Ross (@alexr00)

Activity

  1. added
    containers
    on Nov 8, 2019
  2. alexr00 commented on Nov 22, 2019

    @alexr00
    Member

    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.

  3. Chuxel commented on Nov 22, 2019

    @Chuxel
    MemberAuthor

    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.

  4. chrmarti commented on Nov 22, 2019

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

  5. Chuxel commented on Nov 22, 2019

    @Chuxel
    MemberAuthor

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

  6. egamma commented on Feb 5, 2020

    @egamma
    Member

    Fixed in the common forwarded view.

  7. locked and limited conversation to collaborators on Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

containers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions