SITL+GAZEBO+VSC Docker | Default port 5760 already in use

Hello,
I configured docker for ardupilot sitl with gazebo harmonic following the instructions from:

I have got a similar setup on host machine and it works flawlessly.
However, I have setup docker to work in VSC dev containers. The problem arises when I connect to container through VSC. I’ve discovered that VSC uses some ports like 5760, 5860, … etc, therefore default simulation port is blocked and the whole setup does not work.
Thank you, czuczo :grin:

Shortly after posting this question I have discovered why VS Code uses these ports.
This is due to automatic port forwarding. Each time sim_vehicle.py is called, VS Code in dev container recognizes that there is some service on localhost:5760 and forwards this port. Then it gets blocked immediately and whole SITL setup doesn’t work. The port forwarding persists even when you end the session and come back later.
To solve this issue one can turn off automatic port forwarding by adding the code below to devcontainer.json.

"vscode": {
    "settings": {
        "remote.autoForwardPorts": false
      }
}
1 Like

Can you issue a PR to our upstream repository for this?

What docker image did you use for gazebo harmonic? I don’t see a harmonic tag in the official gazebo docker hub.