Skip to content
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

Improve port snippets and detecting already in use/restricted ports #2535

Closed
ucheNkadiCode opened this issue Dec 3, 2020 · 4 comments
Closed

Comments

@ucheNkadiCode
Copy link
Contributor

When users are typing in ports in their compose, we provide a snippet that says
ports:
- "hostPort:containerPort" (although we may simply want “- hostPort” since Docker will decide the container port)

Also:
• We help Users to know which ports are already in use by another container on their host machine (yellow squigglies). We already expect containerports to be taken care of by the Docker Inc.
• We help users to know which ports are likely to be restricted (generally on Mac/Linux for ports below 1024)

Suggestions can be given if (not exhaustive):

  1. The user is exposing or accessing a restricted port in a Dockerfile/Compose that will likely cause and error.
  2. The user is declaring ports in compose file (hostPort:containerPort) that are already in use by the host machine (hostPort) or within the Docker Network (containerPort)
  3. If the user is hardcoding the container port in some kind of launchsetting or compose file when they could be allowing Docker to choose a container port for them
@bwateratmsft
Copy link
Collaborator

Duping to #2539

@ucheNkadiCode
Copy link
Contributor Author

@bwateratmsft I think this affects a bit of Dockerfiles too because of how users may be using the EXPOSE command to open restricted ports. Also any sort of port viewer can be considered more of a Tooling feature and not compose specific.

@PavelSosin-320
Copy link

@ucheNkadiCode The Internet works because actually, the developer doesn't need to think and define blacklists and exclusions It is already standardized IANA TCP port numbers registry. In development, only dynamic port numbers 49152-65535 are used to avoid conflicts with existing software. For example, HTTP port 80 is mapped to Host port 8080 for testing. Multinode Cloud clusters use this range too to enable scalability: one service (container or pod) can expose a list of ports or a range of ports that are mapped randomly to host nodes but the mapping is known to the load balancer. It can transfer requests to the available node and port to be processed by the container.
When user exposes well-known ports they must be mapped to the port that infrastructure, firewalls proxies allow passing. For example, mapping 80:80 is OK when Docker, Kubernetes, AWS have configured filters. Docker configures iptables firewall for every published(!) port.
I believe that the restriction of port forwarding only by upper port numbers in the dynamic port range is enough.

@PavelSosin-320
Copy link

@bwateratmsft Since in the following list some port numbers are registered by Microsoft Registered port numbers. The creation of the parallel mechanism by Microsoft is a self-harming decision). The registered port number range must be excluded automatically. Private port number interval must be enabled automatically.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants