microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.67k stars 292 forks source link

Dev Containers: Possible bug with "appPort" property #9890

Open ma-Tehwush opened 6 months ago

ma-Tehwush commented 6 months ago

In devcontainers.json when I have: "appPort": ["8000:8000"] and I build container, ports are like this: 8000string But when I have "appPort": [8000] they are like this: 8000number I thought these two settings were doing the same. But actually, bare 8000 number forwards only 127.0.0.1 which won't allow connections from outside of the host machine.

Is it a bug or a feature?

chrmarti commented 5 months ago

The hover on the "appPort" property shows:

Application ports that are exposed by the container. This can be a single port or an array of ports. Each port can be a number or a string. A number is mapped to the same port on the host. A string is passed to Docker unchanged and can be used to map ports differently, e.g. "8000:8010".

This could be clarified a bit by saying that the number syntax will only listen on that port on the loopback network interface.

ma-Tehwush commented 5 months ago

Thank you for clarification :)

Actually I only have read docs from:

I would say these also could be improved.