-
Notifications
You must be signed in to change notification settings - Fork 330
Port forwarding issue in Containers #1009
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
Comments
VS Code Remote Containers supports 2 ways to forward ports:
What you observe is that the The What I suspect is that Flask opens another port than you expect |
I have the same issue. temporarily: works fine. [EDIT] |
I fixed this by changing my "applicationUrl": "http://localhost:5001;http://localhost:5000", to "applicationUrl": "http://0.0.0.0:5001;http://0.0.0.0:5000", This allowed the EDIT: I was having this problem with a ASP.NET Core Development Container, but the problem seems to be the same regardless of what is hosted. |
Yes, this makes sense - when you set things up to "always" connect, it's actually "publishing" the port from the container rather than forwarding it per-se. (This is "-p" in the Docker case.) When you connect to the server, it looks like a non-local IP coming across. By updating to In the case of temporary, this is an actual forwarding mechanism - it will look to the server like it actually is coming from localhost. This is done because you cannot publish ports on a running container and as a side effect you can connect to things that you would not normally be able to connect to. Our examples show using 0.0.0.0 instead of localhost because of these differences. |
I have the exact same problem: temporarily port forwarding via VS Code works fine,
For future readers that are working with a Flask standalone application: |
Ahh! This makes so much sense! Thank you Mr @Chuxel, for the explanation! |
I'm experiencing the same port forwarding issue. My environment is Windows 10 1903. VSCode 1.39.1. My configuration is based on the vscode-remote-try-node git. The only change is The server printed
But when I tried the URL on my host, neither of the URLs worked. If I ctrl-clicked the URL shown on the terminal, the URL opened on the host was with port 8811 or some other random port. I double checked on docker using I also tried The |
You can fix that by asking Angular to listen on Refer to the comment by |
@MythreyaK Thanks for your advice. Once I run |
@Chuxel The discussion makes me wonder if we should change At the same time there are efforts to make setting up the dynamic port forwarding easier. So it might not make sense to change the existing behavior and we might instead just remove /cc @alexr00 |
One thing that might help this with the new port UI is that I want to show address:port, so for published ports it would be clear that it isn't just localhost. |
The plan here is to introduce We would then rewrite all samples and definitions to use There is some overlap with the core's plan on restoring previous forwardings per workspace URI (disabled by default at first), but it still seems to make sense to have this support in the |
On my .NET Core project using dev containers, I was able to get my project to work by making the following change: I fixed this by changing my launchSettings.json from:
to
I utilized the
|
@joswalt With the upcoming release (currently available for VS Code Insiders) you can also: Keep listening on |
I'm currently experiencing issues with port forwarding for remote development containers. I have tried following the walkthrough in the documentation, and using the port forward command in VSCode. But so far I have been unable to call my API running in the container from my local machine.
UPDATE: I have worked out if I remove the appPort from the devcontainer.json and forward it manually then the port forwarding works without issue. Not sure if this is desired behaviour for the appPort or not?
Has anyone else experienced similar issues?
Steps to Reproduce:
Does this issue occur when you try this locally?: No
Does this issue occur when you try this locally and all extensions are disabled?: No
Additional Troubleshooting:
Possibly related issues:
Files:
The text was updated successfully, but these errors were encountered: