Skip to content

Cannot forward EXPOSEd port #137

Closed
Closed

Description

@ericblade
  • VSCode Version: 1.34.1
  • Local OS Version: Win 10 1809
  • Remote OS Version: Docker whatever the node containers use
  • Remote Extension/Connection Type: SSH/Docker/WSL

I'm not sure if I'm misunderstanding how something works, or not, but my Dockerfile has an EXPOSE 3000 in it, indicating that port 3000 should be available for mapping to the outside world. When I build that container and connect to it with Remote-Containers, I am unable to successfully port forward that to outside of the container, so it can be reached from the local browser. I have tested it inside the container, and it is reachable, but the port forwarding command does not forward it. It says that it tries to forward "undefined", which fails.

Activity

  1. added
    containers
    on May 5, 2019
  2. added
    feature-request
    on May 6, 2019
  3. egamma commented on May 6, 2019

    @egamma
    Member

    Eric Blade (@ericblade) the EXPOSE statement in a Dockerfile is currently not honored when running the container. You have to either define the port as an appPort in devcontainer.json or forward the port dynamically. pls see https://code.visualstudio.com/docs/remote/containers#_forwarding-a-port

  4. ericblade commented on May 6, 2019

    @ericblade
    Author

    Erich Gamma (@egamma) the problem on top of that is that I can't forward the port dynamically -- when I select it from the list, or enter it manually, it tries to forward port "undefined", which fails.

    I'll try the appPort and see if that helps.

  5. ericblade commented on May 7, 2019

    @ericblade
    Author

    update: appPort does work, after rebuilding the container. still find it odd that asking it to forward the exposed port dynamically fails, though

  6. egamma commented on May 7, 2019

    @egamma
    Member

    Eric Blade (@ericblade)

    I can't forward the port dynamically -- when I select it from the list, or enter it manually, it tries to forward port "undefined", which fails.

    Can you please file a separate issue on the dynamic port forwarding failure, this looks like a separate bug. Please include a screenshot of what is shown in the quickpick dialog box when you select a port.

  7. chrmarti commented on May 7, 2019

    @chrmarti
    Contributor

    Note: docker run's --publish-all / -P would publish all exposed ports.

  8. bamurtaugh commented on Oct 16, 2020

    @bamurtaugh
    Member

    Since it looks like the separate issue about dynamic port forwarding has been addressed and there hasn't been new discussion here, I'm thinking we can close this issue? Eric Blade (@ericblade) if you don't have any other outstanding questions or requests here, I will go ahead and close it.

  9. ericblade commented on Oct 17, 2020

    @ericblade
    Author

    I"m thinking since I haven't attempted to use this in about a year now, it's probably not relevant, or been solved.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    containersfeature-request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions