After switching to Cursor Dev Containers extension, I can’t access to my application from the intended port. On the port forwarding window, it shows that it forwards ports to a random port.
Steps to Reproduce
Open the project with dev containers and just run your app
Expected Behavior
My app runs on port 8000, i must be able to access it from localhost:8000, now i can only access from the random port curor gives. It works normally on vscode
I ran into this issue as well after updating Cursor yesterday. In my case there is no “random port” to connect to. As long as Cursor IDE is running, I’m locked out of the service I need to access. This is a showstopper for me and, as a consequence, I unfortunately have to stop using Cursor IDE until it’s fixed.
I also confirmed that VSCode does not have this issue. When I open my project in VSCode I can access the service via http://localhost:8081 without issue. The moment I fire up Cursor however, the page continuously tries to load in the browser but never finishes. I also get an error in the console whenever the initial HTTP request is made from my browser:
Error: connect ECONNREFUSED 127.0.0.1:port_number
Some details about my setup:
I am using the Dev Containers extension and it’s up to date. ms-vscode-remote is the id.
I have a docker compose stack running the full Camunda 8 suite of software. I simply added my devcontainer to the compose stack in .devcontainer/docker-compose.yaml. My devcontainer.json points to this compose file, and everything was working fine before I updated Cursor yesterday (7/3/2025).
I do happen to have a lot of ports mapped – 31 to be exact. I’m writing a Java application with Spring Boot and that can’t be helped unfortunately. There are no visible conflicts and this shouldn’t ultimately be a problem.
I’m running Mac OS X 15.5 on a MacBook Pro 16-inch, Nov 2024 with Apple M4 Pro with 48GB of RAM.
Firing up Cursor brings up the compose stack if it wasn’t already up previously. I cannot access the service on port 8081 as long as Cursor is running. Quitting cursor leaves the compose stack running in Docker. I can immediately access the service once Cursor is no longer running.
I tried the following but the problem persists:
Quit Cursor.
docker rm -f $(docker ps -aq) && docker volume prune -a -f && docker network rm $(docker network ls -q).
Start Cursor.
That amounts to a complete refresh of the entire docker compose stack, pulling fresh images and re-creating all docker networks fresh from config. This is definitely an issue with Cursor port forwarding in some form or fashion.
I hope this helps! I really love this product, please keep up the excellent work!
Just to confirm, are you using the ms-vscode-remote.remote-containers extension or the anysphere.remote-containers extension?
We just pushed an update for the anysphere.remote-containers extension (version 1.0.13) that adds support for the forwardPorts section of the devcontainer.json. If you’re on an older version of the extension, could you try upgrading to the latest version?
If that still doesn’t work, could you share the logs for the “Remote - Dev Containers” output window so we can take a closer look? Thanks!
I can confirm that port forwarding works again for me.
1 small caveat with it:
The small green dot before some of my forwards are missing.
In VScode, the green dot indicates that a port forward is active and working, but for some reason in Cursor the dot stays white and unfilled in Cursor for some forwards (but works for others) with the exact same project, while the forward does indeed work and is active.